From 7dce62d9ed3d77bde2341545cd3318cab6d6c563 Mon Sep 17 00:00:00 2001 From: chn Date: Thu, 21 Sep 2023 15:56:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E6=AC=A1=E5=BF=98=E4=BA=86=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E4=BA=86=EF=BC=8C=E6=88=91=E4=B9=9F=E4=B8=8D=E8=AE=B0?= =?UTF-8?q?=E5=BE=97=E6=9B=B4=E6=94=B9=E4=BA=86=E5=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Form1.Designer.vb | 118 +++++++++++++++------------------------------- Form1.vb | 76 +++++++++++++++++------------ 2 files changed, 85 insertions(+), 109 deletions(-) diff --git a/Form1.Designer.vb b/Form1.Designer.vb index f55ec08..c6965d5 100644 --- a/Form1.Designer.vb +++ b/Form1.Designer.vb @@ -33,9 +33,6 @@ Partial Class Form1 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.Timer2 = New System.Windows.Forms.Timer(Me.components) Me.Label5 = New System.Windows.Forms.Label() @@ -44,17 +41,17 @@ Partial Class Form1 Me.Button7 = New System.Windows.Forms.Button() Me.Button8 = New System.Windows.Forms.Button() Me.Label6 = New System.Windows.Forms.Label() - Me.SuspendLayout() + Me.SuspendLayout ' 'Button1 ' Me.Button1.Font = New System.Drawing.Font("Microsoft YaHei UI", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) - Me.Button1.Location = New System.Drawing.Point(231, 316) + Me.Button1.Location = New System.Drawing.Point(231, 249) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(170, 72) Me.Button1.TabIndex = 0 Me.Button1.Text = "开始抽奖" - Me.Button1.UseVisualStyleBackColor = True + Me.Button1.UseVisualStyleBackColor = true ' 'Button2 ' @@ -64,12 +61,12 @@ Partial Class Form1 Me.Button2.Size = New System.Drawing.Size(147, 60) Me.Button2.TabIndex = 1 Me.Button2.Text = "换一个" - Me.Button2.UseVisualStyleBackColor = True - Me.Button2.Visible = False + Me.Button2.UseVisualStyleBackColor = true + Me.Button2.Visible = false ' 'Label1 ' - Me.Label1.AutoSize = True + Me.Label1.AutoSize = true Me.Label1.Font = New System.Drawing.Font("Microsoft YaHei UI", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) Me.Label1.Location = New System.Drawing.Point(51, 45) Me.Label1.Name = "Label1" @@ -83,7 +80,7 @@ Partial Class Form1 Me.TextBox1.Font = New System.Drawing.Font("Microsoft YaHei UI", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) Me.TextBox1.Location = New System.Drawing.Point(217, 42) Me.TextBox1.Name = "TextBox1" - Me.TextBox1.ReadOnly = True + Me.TextBox1.ReadOnly = true Me.TextBox1.Size = New System.Drawing.Size(198, 52) Me.TextBox1.TabIndex = 3 Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center @@ -94,14 +91,14 @@ Partial Class Form1 Me.TextBox2.Font = New System.Drawing.Font("Microsoft YaHei UI", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) Me.TextBox2.Location = New System.Drawing.Point(217, 108) Me.TextBox2.Name = "TextBox2" - Me.TextBox2.ReadOnly = True + Me.TextBox2.ReadOnly = true Me.TextBox2.Size = New System.Drawing.Size(198, 52) Me.TextBox2.TabIndex = 6 Me.TextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center ' 'Label2 ' - Me.Label2.AutoSize = True + Me.Label2.AutoSize = true Me.Label2.Font = New System.Drawing.Font("Microsoft YaHei UI", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) Me.Label2.Location = New System.Drawing.Point(51, 111) Me.Label2.Name = "Label2" @@ -117,8 +114,8 @@ Partial Class Form1 Me.Button3.Size = New System.Drawing.Size(147, 60) Me.Button3.TabIndex = 4 Me.Button3.Text = "换一个" - Me.Button3.UseVisualStyleBackColor = True - Me.Button3.Visible = False + Me.Button3.UseVisualStyleBackColor = true + Me.Button3.Visible = false ' 'TextBox3 ' @@ -126,14 +123,14 @@ Partial Class Form1 Me.TextBox3.Font = New System.Drawing.Font("Microsoft YaHei UI", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) Me.TextBox3.Location = New System.Drawing.Point(217, 174) Me.TextBox3.Name = "TextBox3" - Me.TextBox3.ReadOnly = True + Me.TextBox3.ReadOnly = true Me.TextBox3.Size = New System.Drawing.Size(198, 52) Me.TextBox3.TabIndex = 9 Me.TextBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center ' 'Label3 ' - Me.Label3.AutoSize = True + Me.Label3.AutoSize = true Me.Label3.Font = New System.Drawing.Font("Microsoft YaHei UI", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) Me.Label3.Location = New System.Drawing.Point(51, 177) Me.Label3.Name = "Label3" @@ -149,40 +146,8 @@ Partial Class Form1 Me.Button4.Size = New System.Drawing.Size(147, 60) Me.Button4.TabIndex = 7 Me.Button4.Text = "换一个" - Me.Button4.UseVisualStyleBackColor = True - Me.Button4.Visible = False - ' - 'TextBox4 - ' - Me.TextBox4.BackColor = System.Drawing.SystemColors.HighlightText - Me.TextBox4.Font = New System.Drawing.Font("Microsoft YaHei UI", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) - Me.TextBox4.Location = New System.Drawing.Point(217, 240) - Me.TextBox4.Name = "TextBox4" - Me.TextBox4.ReadOnly = True - Me.TextBox4.Size = New System.Drawing.Size(198, 52) - Me.TextBox4.TabIndex = 12 - Me.TextBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center - ' - 'Label4 - ' - Me.Label4.AutoSize = True - Me.Label4.Font = New System.Drawing.Font("Microsoft YaHei UI", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) - Me.Label4.Location = New System.Drawing.Point(51, 243) - Me.Label4.Name = "Label4" - Me.Label4.Size = New System.Drawing.Size(160, 46) - Me.Label4.TabIndex = 11 - Me.Label4.Text = "第四小组" - ' - 'Button5 - ' - Me.Button5.Font = New System.Drawing.Font("Microsoft YaHei UI", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) - Me.Button5.Location = New System.Drawing.Point(421, 236) - Me.Button5.Name = "Button5" - Me.Button5.Size = New System.Drawing.Size(147, 60) - Me.Button5.TabIndex = 10 - Me.Button5.Text = "换一个" - Me.Button5.UseVisualStyleBackColor = True - Me.Button5.Visible = False + Me.Button4.UseVisualStyleBackColor = true + Me.Button4.Visible = false ' 'Timer1 ' @@ -190,62 +155,62 @@ Partial Class Form1 ' 'Timer2 ' - Me.Timer2.Enabled = True + Me.Timer2.Enabled = true Me.Timer2.Interval = 500 ' 'Label5 ' - Me.Label5.AutoSize = True - Me.Label5.Location = New System.Drawing.Point(333, 500) + Me.Label5.AutoSize = true + Me.Label5.Location = New System.Drawing.Point(352, 437) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(244, 17) Me.Label5.TabIndex = 13 - Me.Label5.Text = "code by 陈浩南@第一小组 2022年9月11日" + Me.Label5.Text = "code by 陈浩南@第一小组 2022年9月22日" Me.Label5.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'Button6 ' - Me.Button6.Location = New System.Drawing.Point(160, 500) + Me.Button6.Location = New System.Drawing.Point(109, 434) Me.Button6.Name = "Button6" Me.Button6.Size = New System.Drawing.Size(107, 23) Me.Button6.TabIndex = 14 Me.Button6.Text = "导出名单到excel" - Me.Button6.UseVisualStyleBackColor = True + Me.Button6.UseVisualStyleBackColor = true ' 'CheckBox1 ' - Me.CheckBox1.AutoSize = True - Me.CheckBox1.Checked = True + Me.CheckBox1.AutoSize = true + Me.CheckBox1.Checked = true Me.CheckBox1.CheckState = System.Windows.Forms.CheckState.Checked - Me.CheckBox1.Location = New System.Drawing.Point(73, 411) + Me.CheckBox1.Location = New System.Drawing.Point(78, 327) Me.CheckBox1.Name = "CheckBox1" Me.CheckBox1.Size = New System.Drawing.Size(471, 38) Me.CheckBox1.TabIndex = 15 - Me.CheckBox1.Text = "尽量避免重复" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "(已经抽到过的人将不再被抽到,除非程序被重启或那个小组的人都轮换了一遍。)" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) - Me.CheckBox1.UseVisualStyleBackColor = True + Me.CheckBox1.Text = "尽量避免重复"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"(已经抽到过的人将不再被抽到,除非程序被重启或那个小组的人都轮换了一遍。)"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10) + Me.CheckBox1.UseVisualStyleBackColor = true ' 'Button7 ' - Me.Button7.Location = New System.Drawing.Point(63, 468) + Me.Button7.Location = New System.Drawing.Point(12, 406) Me.Button7.Name = "Button7" Me.Button7.Size = New System.Drawing.Size(81, 23) Me.Button7.TabIndex = 16 Me.Button7.Text = "下载最新版" - Me.Button7.UseVisualStyleBackColor = True + Me.Button7.UseVisualStyleBackColor = true ' 'Button8 ' - Me.Button8.Location = New System.Drawing.Point(63, 500) + Me.Button8.Location = New System.Drawing.Point(12, 434) Me.Button8.Name = "Button8" Me.Button8.Size = New System.Drawing.Size(81, 23) Me.Button8.TabIndex = 17 Me.Button8.Text = "获取源代码" - Me.Button8.UseVisualStyleBackColor = True + Me.Button8.UseVisualStyleBackColor = true ' 'Label6 ' - Me.Label6.AutoSize = True - Me.Label6.Location = New System.Drawing.Point(150, 471) + Me.Label6.AutoSize = true + Me.Label6.Location = New System.Drawing.Point(99, 409) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(181, 17) Me.Label6.TabIndex = 18 @@ -253,18 +218,15 @@ Partial Class Form1 ' 'Form1 ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 17.0!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(7!, 17!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(603, 537) + Me.ClientSize = New System.Drawing.Size(608, 464) Me.Controls.Add(Me.Label6) Me.Controls.Add(Me.Button8) Me.Controls.Add(Me.Button7) Me.Controls.Add(Me.CheckBox1) Me.Controls.Add(Me.Button6) Me.Controls.Add(Me.Label5) - 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) @@ -277,13 +239,14 @@ Partial Class Form1 Me.Controls.Add(Me.Button1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D Me.ImeMode = System.Windows.Forms.ImeMode.Disable - Me.MaximizeBox = False + Me.MaximizeBox = false Me.Name = "Form1" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "KK集团大组会抽奖" - Me.ResumeLayout(False) - Me.PerformLayout() + Me.ResumeLayout(false) + Me.PerformLayout - End Sub +End Sub Friend WithEvents Button1 As Button Friend WithEvents Button2 As Button @@ -295,9 +258,6 @@ Partial Class Form1 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 Timer2 As Timer Friend WithEvents Label5 As Label diff --git a/Form1.vb b/Form1.vb index 3b33520..835ae8e 100644 --- a/Form1.vb +++ b/Form1.vb @@ -5,38 +5,38 @@ Public Class Form1 { New List(Of String) From { - "蔡文为", "蔡叶杭", "陈秉桓", "陈柏逸", "陈瀚", "陈浩南", "陈俊鑫", "陈心路", "付星瑞", "郭斌", "郭中丽", - "胡汛", "江莹", "李鹏岗", "林泽锋", "刘国振", "刘璐", "刘志强", "卢诗强", "邱鸿伟", "沈鹏", "石澜", "唐锐凡", - "唐燕", "王豪", "王丽兰", "王永嘉", "项磊磊", "闫金健", "杨谦益", "张宏烨", "赵珊珊", "赵政仰", "钟志白", "周其程" + "李鹏岗", "唐燕", "沈鹏", "陈心路", "赵珊珊", "郭中丽", "林科闯", "闫金健", "江莹", "陈浩南", + "蔡叶杭", "林泽锋", "周其程", "石澜", "胡汛", "邱鸿伟", "杨谦益", "王豪", "陈柏逸", "刘志强", + "赵政仰", "项磊磊", "付星瑞", "黄敏", "刘祥炜", "王轶蒙", "杨仕铌", "余路成", "朱玲俐", "杨攀", + "高郁捷", "莫梦月", "徐溢聪", "张林珏", "陈芳琦", "许腾飞", "黄研培", "厉亚凯", "谈奇灵", "马雯", + "姚隽祺", "张恩铭" }, New List(Of String) From { - "邓铁龙", "杜颖", "黄鑫", "林高翔", "楼伟涛", "曲真魁", "萨娜", "沈晓鑫", "汤昊", "吐尔洪江 吾拉木 ", "王小丹", - "王紫云", "向阳", "邢欢", "许书逸", "张晓娟", "赵经天", "郑力诚" + "吐尔洪江·吾拉木", "萨娜", "王小丹", "林高翔", "邓铁龙", "许书逸", "张晓娟", "邢欢", "黄鑫", "沈晓鑫", + "曲真魁", "楼伟涛", "杜颖", "汤昊", "向阳", "周亮", "鲁浩伟", "梁雁彤", "杨仁琪", "陈豪飞", + "张润涵" }, New List(Of String) From { - "曾鑫龙", "常青", "陈铭禹", "陈子龙", "范洋涛", "费煜晨", "高扬钧", "胡玮琳", "黄飞鸿", - "蓝进肾", "李光容", "李锦安", "李迎秋", "林建平", "刘海洋", "柳梦宇", "莫炳杰", "聂思晴", - "曲善直", "唐唯卿", "万景", "吴启鹏", "吴维", "吴雪峰", "徐望舒", "杨成彪", "叶晓芳", - "张腾", "张裕祥", "张宗南", "周小龙" - }, - New List(Of String) From - { - "陈晨", "黄家新", "黄昱祺", "刘兴宜", "平坦", "檀鹏", "吴建峰", "徐聪卉", "张爱忠", "张耀宗" + "莫炳杰", "吴雪峰", "刘海洋", "张宗南", "张裕祥", "蓝进肾", "叶晓芳", "周江鹏", "柳梦宇", "费煜晨", + "万景", "檀鹏", "陈晨", "吴启鹏", "黄飞鸿", "胡玮琳", "杨成彪", "李迎秋", "平坦", "曲善直", + "陈子龙", "陈铭禹", "李锦安", "高扬钧", "吴维", "张腾", "常青", "张爱忠", "张耀宗", "黄家新", + "姚文龙", "张为智", "黄昱祺", "郑一帆", "马梦薇", "程安琪", "张晨昊", "危永平", "叶颖", "周博语", + "刘敏", "吴世明", "刘源 ", "程可扬", "宋欣格", "李文翔" } } - Private StudentsUsed_ As New List(Of List(Of String)) From {New List(Of String), New List(Of String), New List(Of String), New List(Of String)} + Private StudentsUsed_ As New List(Of List(Of String)) From {New List(Of String), New List(Of String), New List(Of String)} - Private TextBox_(3) As TextBox - Private ButtonRegenerate_(3) As Button + Private TextBox_(2) As TextBox + Private ButtonRegenerate_(2) As Button Public Sub New() ' 此调用是设计器所必需的。 InitializeComponent() ' 在 InitializeComponent() 调用之后添加任何初始化。 - TextBox_ = {TextBox1, TextBox2, TextBox3, TextBox4} - ButtonRegenerate_ = {Button2, Button3, Button4, Button5} + TextBox_ = {TextBox1, TextBox2, TextBox3} + ButtonRegenerate_ = {Button2, Button3, Button4} OfficeOpenXml.ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial End Sub @@ -62,7 +62,7 @@ Public Class Form1 End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick - For i As Integer = 0 To 3 + For i As Integer = 0 To 2 set_select_name(i) Next End Sub @@ -70,24 +70,24 @@ Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If (Timer1.Enabled) Then Timer1.Enabled = False - For i As Integer = 0 To 3 + For i As Integer = 0 To 2 move_to_used(i, TextBox_(i).Text) Next Button1.Text = "再来一次" - For i As Integer = 0 To 3 + For i As Integer = 0 To 2 ButtonRegenerate_(i).Visible = True Next Else Timer1.Enabled = True Button1.Text = "停!" - For i As Integer = 0 To 3 + For i As Integer = 0 To 2 ButtonRegenerate_(i).Visible = False Next 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 + Private Sub ButtonRefresh_Click(sender As Object, e As EventArgs) Handles Button2.Click, Button3.Click, Button4.Click + For i As Integer = 0 To 2 If sender Is ButtonRegenerate_(i) Then set_select_name(i) move_to_used(i, TextBox_(i).Text) @@ -96,9 +96,25 @@ Public Class Form1 End Sub Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick - If Not Timer1.Enabled AndAlso TextBox_(0).Text.StartsWith("陈浩") Then - TextBox_(0).Text = "陈浩" + New List(Of String) From {"东", "西", "南", "北"}((New Random).Next(0, 4)) - TextBox_(0).Refresh() + If Not Timer1.Enabled Then + If TextBox_(0).Text.StartsWith("陈浩") Then + TextBox_(0).Text = "陈浩" + New List(Of String) From {"东", "西", "南", "北"}((New Random).Next(0, 4)) + TextBox_(0).Refresh() + ElseIf TextBox_(0).Text.StartsWith("陈心") Then + If (New Random).Next(0, 4) = 0 Then + TextBox_(0).Text = "陈心街" + Else + TextBox_(0).Text = "陈心路" + End If + TextBox_(0).Refresh() + ElseIf TextBox_(0).Text = "闫金健" Or TextBox_(0).Text = "闫银健" Then + If (New Random).Next(0, 4) = 0 Then + TextBox_(0).Text = "闫银健" + Else + TextBox_(0).Text = "闫金健" + End If + TextBox_(0).Refresh() + End If End If ' If Me.Text = "" Then ' Me.Text = "激★情★大★抽★奖" @@ -113,7 +129,7 @@ Public Class Form1 Dim result = dialog.ShowDialog() Dim students As New List(Of List(Of String)) students = Students_ - For i As Integer = 0 To 3 + For i As Integer = 0 To 2 students(i).AddRange(StudentsUsed_(i)) Next If result = DialogResult.OK Then @@ -121,7 +137,7 @@ Public Class Form1 If FileIO.FileSystem.FileExists(dialog.FileName) Then FileIO.FileSystem.DeleteFile(dialog.FileName) Dim file As New OfficeOpenXml.ExcelPackage(dialog.FileName) Dim sheet = file.Workbook.Worksheets.Add("分组名单") - For i As Integer = 0 To 3 + For i As Integer = 0 To 2 Dim c = Chr(Asc("A"c) + i) sheet.Cells(c + "1").Value = "第" + Convert.ToString(i + 1) + "小组" For j As Integer = 0 To students(i).Count - 1 @@ -153,7 +169,7 @@ Public Class Form1 End Sub Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged - For i As Integer = 0 To 3 + For i As Integer = 0 To 2 Students_(i).AddRange(StudentsUsed_(i)) StudentsUsed_(i).Clear() Next