diff --git a/ApplicationEvents.vb b/ApplicationEvents.vb new file mode 100644 index 0000000..cf403a0 --- /dev/null +++ b/ApplicationEvents.vb @@ -0,0 +1,29 @@ +Imports Microsoft.VisualBasic.ApplicationServices + +Namespace My + ' The following events are available for MyApplication: + ' Startup: Raised when the application starts, before the startup form is created. + ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally. + ' UnhandledException: Raised if the application encounters an unhandled exception. + ' StartupNextInstance: Raised when launching a single-instance application and the application is already active. + ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected. + + ' **NEW** ApplyApplicationDefaults: Raised when the application queries default values to be set for the application. + + ' Example: + ' Private Sub MyApplication_ApplyApplicationDefaults(sender As Object, e As ApplyApplicationDefaultsEventArgs) Handles Me.ApplyApplicationDefaults + ' + ' ' Setting the application-wide default Font: + ' e.Font = New Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular) + ' + ' ' Setting the HighDpiMode for the Application: + ' e.HighDpiMode = HighDpiMode.PerMonitorV2 + ' + ' ' If a splash dialog is used, this sets the minimum display time: + ' e.MinimumSplashScreenDisplayTime = 4000 + ' End Sub + + Partial Friend Class MyApplication + + End Class +End Namespace diff --git a/Form1.Designer.vb b/Form1.Designer.vb new file mode 100644 index 0000000..215e824 --- /dev/null +++ b/Form1.Designer.vb @@ -0,0 +1,230 @@ + +Partial Class Form1 + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() + Me.Button1 = New System.Windows.Forms.Button() + Me.Button2 = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.Button3 = New System.Windows.Forms.Button() + Me.TextBox3 = New System.Windows.Forms.TextBox() + Me.Label3 = New System.Windows.Forms.Label() + Me.Button4 = New System.Windows.Forms.Button() + Me.TextBox4 = New System.Windows.Forms.TextBox() + Me.Label4 = New System.Windows.Forms.Label() + Me.Button5 = New System.Windows.Forms.Button() + Me.Timer1 = New System.Windows.Forms.Timer(Me.components) + Me.PictureBox1 = New System.Windows.Forms.PictureBox() + CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.Button1.Location = New System.Drawing.Point(115, 246) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(125, 49) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "开始抽奖" + Me.Button1.UseVisualStyleBackColor = True + ' + 'Button2 + ' + Me.Button2.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.Button2.Location = New System.Drawing.Point(602, 33) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(107, 38) + Me.Button2.TabIndex = 1 + Me.Button2.Text = "换一个" + Me.Button2.UseVisualStyleBackColor = True + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.Label1.Location = New System.Drawing.Point(356, 38) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(96, 28) + Me.Label1.TabIndex = 2 + Me.Label1.Text = "第一小组" + ' + 'TextBox1 + ' + Me.TextBox1.BackColor = System.Drawing.SystemColors.HighlightText + Me.TextBox1.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.TextBox1.Location = New System.Drawing.Point(458, 35) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.ReadOnly = True + Me.TextBox1.Size = New System.Drawing.Size(138, 34) + Me.TextBox1.TabIndex = 3 + ' + 'TextBox2 + ' + Me.TextBox2.BackColor = System.Drawing.SystemColors.HighlightText + Me.TextBox2.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.TextBox2.Location = New System.Drawing.Point(458, 79) + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.ReadOnly = True + Me.TextBox2.Size = New System.Drawing.Size(138, 34) + Me.TextBox2.TabIndex = 6 + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.Label2.Location = New System.Drawing.Point(356, 82) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(96, 28) + Me.Label2.TabIndex = 5 + Me.Label2.Text = "第二小组" + ' + 'Button3 + ' + Me.Button3.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.Button3.Location = New System.Drawing.Point(602, 77) + Me.Button3.Name = "Button3" + Me.Button3.Size = New System.Drawing.Size(107, 38) + Me.Button3.TabIndex = 4 + Me.Button3.Text = "换一个" + Me.Button3.UseVisualStyleBackColor = True + ' + 'TextBox3 + ' + Me.TextBox3.BackColor = System.Drawing.SystemColors.HighlightText + Me.TextBox3.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.TextBox3.Location = New System.Drawing.Point(458, 123) + Me.TextBox3.Name = "TextBox3" + Me.TextBox3.ReadOnly = True + Me.TextBox3.Size = New System.Drawing.Size(138, 34) + Me.TextBox3.TabIndex = 9 + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.Label3.Location = New System.Drawing.Point(356, 126) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(96, 28) + Me.Label3.TabIndex = 8 + Me.Label3.Text = "第三小组" + ' + 'Button4 + ' + Me.Button4.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.Button4.Location = New System.Drawing.Point(602, 121) + Me.Button4.Name = "Button4" + Me.Button4.Size = New System.Drawing.Size(107, 38) + Me.Button4.TabIndex = 7 + Me.Button4.Text = "换一个" + Me.Button4.UseVisualStyleBackColor = True + ' + 'TextBox4 + ' + Me.TextBox4.BackColor = System.Drawing.SystemColors.HighlightText + Me.TextBox4.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.TextBox4.Location = New System.Drawing.Point(458, 167) + Me.TextBox4.Name = "TextBox4" + Me.TextBox4.ReadOnly = True + Me.TextBox4.Size = New System.Drawing.Size(138, 34) + Me.TextBox4.TabIndex = 12 + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.Label4.Location = New System.Drawing.Point(356, 170) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(96, 28) + Me.Label4.TabIndex = 11 + Me.Label4.Text = "第四小组" + ' + 'Button5 + ' + Me.Button5.Font = New System.Drawing.Font("Microsoft YaHei UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) + Me.Button5.Location = New System.Drawing.Point(602, 165) + Me.Button5.Name = "Button5" + Me.Button5.Size = New System.Drawing.Size(107, 38) + Me.Button5.TabIndex = 10 + Me.Button5.Text = "换一个" + Me.Button5.UseVisualStyleBackColor = True + ' + 'Timer1 + ' + ' + 'PictureBox1 + ' + Me.PictureBox1.Image = Global.幸运抽奖.My.Resources.Resources.egg_jpg + Me.PictureBox1.Location = New System.Drawing.Point(48, 23) + Me.PictureBox1.Name = "PictureBox1" + Me.PictureBox1.Size = New System.Drawing.Size(272, 208) + Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage + Me.PictureBox1.TabIndex = 13 + Me.PictureBox1.TabStop = False + Me.PictureBox1.Visible = False + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 17.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(763, 319) + Me.Controls.Add(Me.PictureBox1) + Me.Controls.Add(Me.TextBox4) + Me.Controls.Add(Me.Label4) + Me.Controls.Add(Me.Button5) + Me.Controls.Add(Me.TextBox3) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.Button4) + Me.Controls.Add(Me.TextBox2) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.Button3) + Me.Controls.Add(Me.TextBox1) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.Button2) + Me.Controls.Add(Me.Button1) + Me.Name = "Form1" + Me.Text = "Form1" + CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents Button1 As Button + Friend WithEvents Button2 As Button + Friend WithEvents Label1 As Label + Friend WithEvents TextBox1 As TextBox + Friend WithEvents TextBox2 As TextBox + Friend WithEvents Label2 As Label + Friend WithEvents Button3 As Button + Friend WithEvents TextBox3 As TextBox + Friend WithEvents Label3 As Label + Friend WithEvents Button4 As Button + Friend WithEvents TextBox4 As TextBox + Friend WithEvents Label4 As Label + Friend WithEvents Button5 As Button + Friend WithEvents Timer1 As Timer + Friend WithEvents PictureBox1 As PictureBox +End Class diff --git a/Form1.resx b/Form1.resx new file mode 100644 index 0000000..ad145d0 --- /dev/null +++ b/Form1.resx @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/Form1.vb b/Form1.vb new file mode 100644 index 0000000..522dbbd --- /dev/null +++ b/Form1.vb @@ -0,0 +1,64 @@ +Public Class Form1 + Private Students_() As List(Of String) = + { + New List(Of String) From {"张三", "张四", "张五"}, + New List(Of String) From {"李三", "李四", "李五"}, + New List(Of String) From {"王三", "王四", "王五"}, + New List(Of String) From {"赵三", "赵四", "赵五"} + } + Private TextBox_(3) As TextBox + Private ButtonRegenerate_(3) As Button + + Public Sub New() + ' 此调用是设计器所必需的。 + InitializeComponent() + ' 在 InitializeComponent() 调用之后添加任何初始化。 + TextBox_ = {TextBox1, TextBox2, TextBox3, TextBox4} + ButtonRegenerate_ = {Button2, Button3, Button4, Button5} + End Sub + + Private Sub egg_try_visible() + PictureBox1.Visible = TextBox_(0).Text = "陈浩南" + End Sub + Private Sub egg_invisible() + PictureBox1.Visible = False + End Sub + + Private Sub set_select_name(i As Integer) + Dim rand As New Random + Dim current_text = TextBox_(i).Text + While current_text = TextBox_(i).Text + TextBox_(i).Text = Students_(i)(rand.Next(0, Students_(i).Count)) + End While + TextBox_(i).Refresh() + End Sub + + + Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick + For i As Integer = 0 To 3 + set_select_name(i) + Next + End Sub + + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + If (Timer1.Enabled) Then + Timer1.Enabled = False + Button1.Text = "再来一次" + egg_try_visible() + Else + Timer1.Enabled = True + Button1.Text = "停!" + egg_invisible() + End If + End Sub + + Private Sub ButtonRefresh_Click(sender As Object, e As EventArgs) Handles Button2.Click, Button3.Click, Button4.Click, Button5.Click + For i As Integer = 0 To 3 + If sender Is ButtonRegenerate_(i) Then + set_select_name(i) + End If + Next + egg_try_visible() + End Sub + +End Class diff --git a/My Project/Application.Designer.vb b/My Project/Application.Designer.vb new file mode 100644 index 0000000..094e5d2 --- /dev/null +++ b/My Project/Application.Designer.vb @@ -0,0 +1,38 @@ +'------------------------------------------------------------------------------ +' +' 此代码由工具生成。 +' 运行时版本:4.0.30319.42000 +' +' 对此文件的更改可能会导致不正确的行为,并且如果 +' 重新生成代码,这些更改将会丢失。 +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + '注意:此文件是自动生成的;请勿直接进行修改。若要更改, + ' 或者如果您在此文件中遇到生成错误,请转至项目设计器 + ' (转至“项目属性”或在解决方案资源管理器中双击“我的项目”节点), + ' 然后在“应用程序”选项卡中进行更改。 + ' + Partial Friend Class MyApplication + + _ + Public Sub New() + MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) + Me.IsSingleInstance = true + Me.EnableVisualStyles = true + Me.SaveMySettingsOnExit = true + Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses + End Sub + + _ + Protected Overrides Sub OnCreateMainForm() + Me.MainForm = Global.幸运抽奖.Form1 + End Sub + End Class +End Namespace diff --git a/My Project/Application.myapp b/My Project/Application.myapp new file mode 100644 index 0000000..dc74646 --- /dev/null +++ b/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + true + Form1 + true + 0 + true + 0 + true + \ No newline at end of file diff --git a/My Project/Resources.Designer.vb b/My Project/Resources.Designer.vb new file mode 100644 index 0000000..7fd033d --- /dev/null +++ b/My Project/Resources.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' 此代码由工具生成。 +' 运行时版本:4.0.30319.42000 +' +' 对此文件的更改可能会导致不正确的行为,并且如果 +' 重新生成代码,这些更改将会丢失。 +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + '此类是由 StronglyTypedResourceBuilder + '类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + '若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + '(以 /str 作为命令选项),或重新生成 VS 项目。 + ''' + ''' 一个强类型的资源类,用于查找本地化的字符串等。 + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' 返回此类使用的缓存的 ResourceManager 实例。 + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("幸运抽奖.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' 重写当前线程的 CurrentUICulture 属性,对 + ''' 使用此强类型资源类的所有资源查找执行重写。 + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + + ''' + ''' 查找 System.Drawing.Bitmap 类型的本地化资源。 + ''' + Friend ReadOnly Property egg_jpg() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("egg.jpg", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + End Module +End Namespace diff --git a/My Project/Resources.resx b/My Project/Resources.resx new file mode 100644 index 0000000..dfbaf50 --- /dev/null +++ b/My Project/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + \\192.168.100.1\home\Desktop\006qir4ogy1fzmgwlbz0wj309v06yq5r.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/My Project/app.manifest b/My Project/app.manifest new file mode 100644 index 0000000..c628ed9 --- /dev/null +++ b/My Project/app.manifest @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/幸运抽奖.sln b/幸运抽奖.sln new file mode 100644 index 0000000..2683d82 --- /dev/null +++ b/幸运抽奖.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "幸运抽奖", "幸运抽奖.vbproj", "{9FA8009F-4168-4221-98EF-DEAF6D62D94D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9FA8009F-4168-4221-98EF-DEAF6D62D94D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FA8009F-4168-4221-98EF-DEAF6D62D94D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FA8009F-4168-4221-98EF-DEAF6D62D94D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FA8009F-4168-4221-98EF-DEAF6D62D94D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F939207A-147C-4E59-846D-3C8EF03A9186} + EndGlobalSection +EndGlobal diff --git a/幸运抽奖.vbproj b/幸运抽奖.vbproj new file mode 100644 index 0000000..94105f3 --- /dev/null +++ b/幸运抽奖.vbproj @@ -0,0 +1,57 @@ + + + + WinExe + net6.0-windows + Sub Main + true + WindowsForms + On + My Project\app.manifest + + + + + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036 + + + + + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036 + + + + + + + + + + + True + True + Application.myapp + + + True + True + Resources.resx + + + + + + My.Resources + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + + \ No newline at end of file