-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path抽号Form1.frm
588 lines (579 loc) · 18.5 KB
/
抽号Form1.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
VERSION 5.00
Object = "{6BF52A50-394A-11D3-B153-00C04F79FAA6}#1.0#0"; "wmp.dll"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "Mario Worker杯抽签程序"
ClientHeight = 7155
ClientLeft = 45
ClientTop = 390
ClientWidth = 13230
Icon = "抽号Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7155
ScaleWidth = 13230
StartUpPosition = 3 '窗口缺省
Begin VB.CheckBox Check2
Caption = "清空已抽"
Height = 180
Left = 11400
MaskColor = &H00FFFFFF&
TabIndex = 15
Top = 6120
Width = 180
End
Begin VB.CommandButton CommandUndo
BackColor = &H0057FFE1&
Caption = "撤销"
Enabled = 0 'False
BeginProperty Font
Name = "微软雅黑"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 540
Left = 11400
Style = 1 'Graphical
TabIndex = 13
Top = 5160
Width = 1500
End
Begin VB.CommandButton CommandImport
Caption = "导入名单"
BeginProperty Font
Name = "微软雅黑"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 540
Left = 11400
Style = 1 'Graphical
TabIndex = 12
Top = 2400
Width = 1500
End
Begin VB.CheckBox Check1
Caption = "不重复抽"
Height = 180
Left = 11400
TabIndex = 10
Top = 6620
Width = 180
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 50
Left = 12720
Top = 120
End
Begin VB.TextBox TxtPath
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 9
Text = "Text1"
Top = 2400
Width = 10815
End
Begin VB.CommandButton CommandStop
BackColor = &H008080FF&
Caption = "停止"
BeginProperty Font
Name = "微软雅黑"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 540
Left = 11400
Style = 1 'Graphical
TabIndex = 8
Top = 4320
Width = 1500
End
Begin VB.CommandButton CommandStart
BackColor = &H0079FF87&
Caption = "开始"
BeginProperty Font
Name = "微软雅黑"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 540
Left = 11400
Style = 1 'Graphical
TabIndex = 7
Top = 3480
Width = 1500
End
Begin VB.ListBox List2
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3435
Left = 5880
TabIndex = 5
Top = 3480
Width = 5175
End
Begin VB.ListBox List1
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3435
Left = 240
TabIndex = 0
Top = 3480
Width = 5175
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "清空已抽"
BeginProperty Font
Name = "微软雅黑"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 11760
TabIndex = 16
Top = 6040
Width = 1215
End
Begin WMPLibCtl.WindowsMediaPlayer wmp
Height = 495
Left = 0
TabIndex = 14
Top = 0
Visible = 0 'False
Width = 735
URL = ""
rate = 1
balance = 0
currentPosition = 0
defaultFrame = ""
playCount = 1
autoStart = -1 'True
currentMarker = 0
invokeURLs = -1 'True
baseURL = ""
volume = 50
mute = 0 'False
uiMode = "full"
stretchToFit = 0 'False
windowlessVideo = 0 'False
enabled = -1 'True
enableContextMenu= -1 'True
fullScreen = 0 'False
SAMIStyle = ""
SAMILang = ""
SAMIFilename = ""
captioningID = ""
enableErrorDialogs= 0 'False
_cx = 1296
_cy = 873
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "不重复抽"
BeginProperty Font
Name = "微软雅黑"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 11760
TabIndex = 11
Top = 6540
Width = 1215
End
Begin VB.Label LabelID
BackStyle = 0 'Transparent
Caption = "ID"
BeginProperty Font
Name = "微软雅黑"
Size = 32.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 5880
TabIndex = 6
Top = 1200
Width = 7095
End
Begin VB.Label LabelTitle
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Mario Worker杯抽签程序"
BeginProperty Font
Name = "微软雅黑"
Size = 30
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 0
TabIndex = 4
Top = 240
Width = 13215
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "已抽:"
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5880
TabIndex = 3
Top = 3000
Width = 1815
End
Begin VB.Label LabelCode
BackStyle = 0 'Transparent
Caption = "正在抽:"
BeginProperty Font
Name = "微软雅黑"
Size = 32.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 360
TabIndex = 2
Top = 1200
Width = 5415
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "待抽:"
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 1
Top = 3000
Width = 1935
End
Begin VB.Image Image1
Height = 9000
Left = 0
Picture = "抽号Form1.frx":1CCA
Top = 0
Width = 12000
End
Begin VB.Image Image2
Height = 9000
Left = 12000
Picture = "抽号Form1.frx":6636
Top = 0
Width = 12000
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a(1 To 100) As String, b(1 To 100) As String, c(1 To 100) As String
Dim pick(1 To 100) As String
Dim tmp, num, current As Integer
Dim o, r As Integer, p, q As Long
Private Sub CommandStart_Click()
Check1.Enabled = False
Timer1.Enabled = True
CommandStart.Enabled = False
CommandStop.Enabled = True
CommandImport.Enabled = False
CommandUndo.Enabled = False
LabelCode.Caption = "正在抽:" + a(current + 1)
wmp.URL = bgmusic
wmp.settings.volume = 100
wmp.settings.autoStart = True
wmp.settings.mute = False
wmp.Controls.play
End Sub
Private Sub CommandStop_Click()
p = 1
wmp.settings.volume = 0
wmp.settings.mute = True
wmp.Controls.stop
CommandStop.Enabled = False
CommandStart.Enabled = True
CommandImport.Enabled = True
CommandUndo.Enabled = True
Timer1.Enabled = False
Randomize
tmp = Int(Rnd * (num)) + 1
current = current + 1
pick(current) = b(tmp)
LabelID.Caption = b(tmp)
List2.AddItem a(current) & ": " & b(tmp)
If Check1.Value = 1 Then
For i = 1 To num
If i >= tmp Then b(i) = b(i + 1)
Next i
b(num) = ""
List1.Clear
num = num - 1
For j = 1 To num
List1.AddItem b(j)
Next j
End If
If num <= 1 And Check1.Value = 1 Then
num = 0
current = current + 1
List2.AddItem a(current) & ": " & b(1)
CommandStart.Enabled = False: CommandStop.Enabled = False: CommandUndo.Enabled = True
pick(current) = b(1)
List1.Clear
LabelID.Caption = "抽取结束"
LabelCode.Caption = "正在抽:"
exporter = MsgBox("是否导出结果?", vbYesNo)
1
results = App.Path & "\results" & p & ".txt"
If exporter = vbYes Then
If Dir(results) = "" Then
Open results For Output As #2
For o = 0 To List2.ListCount - 1
Print #2, List2.List(o)
Next
Close #2
Else
p = p + 1
GoTo 1
End If
r = 0
End If
End If
If Check1.Value = 0 And current = num Then
CommandStart.Enabled = False: CommandStop.Enabled = False: CommandUndo.Enabled = True
LabelID.Caption = "抽取结束"
LabelCode.Caption = "正在抽:"
exporter = MsgBox("是否导出结果?", vbYesNo)
2
results = App.Path & "\results" & p & ".txt"
If exporter = vbYes Then
If Dir(results) = "" Then
Open results For Output As #3
For o = 0 To List2.ListCount - 1
Print #3, List2.List(o)
Next
Close #3
Else
p = p + 1
GoTo 2
r = 0
End If
End If
End If
End Sub
Private Sub CommandUndo_Click()
CommandStart.Enabled = True
List2.RemoveItem List2.ListCount - 1
r = 1
If Check1.Value = 1 Then
List1.AddItem pick(current)
num = num + 1
End If
b(num) = pick(current)
current = current - 1
If num = 1 And Check1.Value = 1 Then
List1.AddItem pick(current)
List2.RemoveItem List2.ListCount - 1
num = num + 1
b(num) = pick(current)
current = current - 1
End If
If current = 0 Then CommandUndo.Enabled = False
End Sub
Private Sub CommandImport_Click()
Dim l As String, m, n As Integer
listpath = TxtPath.Text
If r = 1 Then
aaa = MsgBox("是否导入名单?", vbYesNo)
If aaa = vbYes Then
If Check2.Value = 1 Then
List2.Clear
End If
List1.Clear
num = 0: tmp = 1: current = 0
If Dir(listpath) = "" Then
MsgBox "文件不存在!", vbOKOnly, "警告"
Form1.Caption = "Mario Worker杯抽签程序"
LabelTitle.Caption = "Mario Worker杯抽签程序"
q = 1
r = 0
TxtPath.Text = App.Path & "\namelist" & q & ".txt"
CommandStart.Enabled = False: CommandStop.Enabled = False: CommandUndo.Enabled = False
Else
Open listpath For Input As #1
Do While Not EOF(1)
Input #1, l
If m = 0 And Mid(l, 1, 5) <> "Order" And Mid(l, 1, 5) <> "order" Then
Form1.Caption = l
LabelTitle.Caption = l
ElseIf m = 0 And (Mid(l, 1, 5) = "Order" Or Mid(l, 1, 5) = "order") Then
m = 1: n = 1
ElseIf m = 1 And Mid(l, 1, 2) <> "id" And Mid(l, 1, 2) <> "ID" Then
a(n) = l: n = n + 1: num = num + 1
ElseIf m = 1 And (Mid(l, 1, 2) = "id" Or Mid(l, 1, 2) = "ID") Then
m = 2: n = 1
ElseIf m = 2 Then
b(n) = l: n = n + 1
End If
LabelCode.Caption = "正在抽:"
LabelID.Caption = ""
Loop
For k = 1 To num
If b(k) = "" Then b(k) = "<empty>"
Next k
For j = 1 To num
List1.AddItem b(j)
Next j
Close #1
q = q + 1
TxtPath.Text = App.Path & "\namelist" & q & ".txt"
CommandStart.Enabled = True: Check1.Enabled = True: Timer1.Enabled = False: CommandUndo.Enabled = False
End If
End If
ElseIf r = 0 Then
If Check2.Value = 1 Then
List2.Clear
End If
List1.Clear
num = 0: tmp = 1: current = 0
If Dir(listpath) = "" Then
MsgBox "文件不存在!", vbOKOnly, "警告"
Form1.Caption = "Mario Worker杯抽签程序"
LabelTitle.Caption = "Mario Worker杯抽签程序"
q = 1
TxtPath.Text = App.Path & "\namelist" & q & ".txt"
CommandStart.Enabled = False: CommandStop.Enabled = False: CommandUndo.Enabled = False
Else
Open listpath For Input As #1
Do While Not EOF(1)
Input #1, l
If m = 0 And Mid(l, 1, 5) <> "Order" And Mid(l, 1, 5) <> "order" Then
Form1.Caption = l
LabelTitle.Caption = l
ElseIf m = 0 And (Mid(l, 1, 5) = "Order" Or Mid(l, 1, 5) = "order") Then
m = 1: n = 1
ElseIf m = 1 And Mid(l, 1, 2) <> "id" And Mid(l, 1, 2) <> "ID" Then
a(n) = l: n = n + 1: num = num + 1
ElseIf m = 1 And (Mid(l, 1, 2) = "id" Or Mid(l, 1, 2) = "ID") Then
m = 2: n = 1
ElseIf m = 2 Then
b(n) = l: n = n + 1
End If
LabelCode.Caption = "正在抽:"
LabelID.Caption = ""
Loop
For k = 1 To num
If b(k) = "" Then b(k) = "<empty>"
Next k
For j = 1 To num
List1.AddItem b(j)
Next j
Close #1
r = 1
q = q + 1
TxtPath.Text = App.Path & "\namelist" & q & ".txt"
CommandStart.Enabled = True: Check1.Enabled = True: Timer1.Enabled = False: CommandUndo.Enabled = False
End If
End If
End Sub
Private Sub Form_Load()
q = 1
r = 0
TxtPath.Text = App.Path & "\namelist" & q & ".txt"
CommandStart.Enabled = False: CommandStop.Enabled = False
LabelID.Caption = ""
Check1.Value = 1
wmp.URL = App.Path & "\bgmusic.mp3"
wmp.Controls.stop
End Sub
Private Sub Timer1_Timer()
tmp2 = tmp
Do While tmp = tmp2
Randomize
tmp = Int(Rnd * (num)) + 1
LabelID.Caption = b(tmp)
Loop
tmp2 = tmp
End Sub
Private Sub wmp_PlayStateChange(ByVal NewState As Long)
If Timer1.Enabled = True And NewState = 1 Then '1为停止(一曲播完)
wmp.Controls.play '再播放
End If
End Sub
Private Sub Form1_Resize()
LabelTitle.Width = Me.Width / 2
End Sub