?? formb41d.frm
字號(hào):
Text3.Visible = False
Option3(0).Visible = False
Option3(1).Visible = False
Else
Option3(0).Value = True
Option3(0).Caption = bytWm
Option3(1).Caption = bytWm / 2
Text2.Visible = False
Text3 = " " & bytWm - bytRs
End If
Me.Caption = " " & srtGm & " " & strPm & " ( 參賽數(shù):" & bytRs & IIf(bytZs > 0, " 種子數(shù):" & bytZs, "") & " )"
End Sub
Private Sub OptioN3_Click(Index As Integer)
If Index = 0 Then
Label8 = "輪空人數(shù):"
bytWs = bytWm
Text3 = " " & bytWm - bytRs
Else
Label8 = "預(yù)選賽人數(shù):"
bytWs = bytWm / 2
bytYs = 2 * (bytRs - bytWs)
Text3 = " " & bytYs
End If
End Sub
Private Sub Command9_Click() ' 確定位數(shù)及預(yù)選
blnYx = IIf(bytWs < bytRs, True, False)
blnLk = IIf(bytWs > bytRs, True, False)
Frame3.Visible = False
StrMsg = ""
If blnYx Then
StrMsg = " 預(yù)選位數(shù):" & bytYs / 2 & " "
Else
If blnLk Then
StrMsg = " 輪空位數(shù):" & bytWs - bytRs & " "
End If
End If
Me.Caption = " " & srtGm & " " & strPm & " ( 參賽數(shù):" & bytRs & " 位置數(shù):" & bytWs & IIf(bytZs > 0, " 種子數(shù):" & bytZs, "") & StrMsg & " )"
Call P_mmm
End Sub
Private Sub P_mmm()
ReDim arrWz(bytWs), arrBg(bytWs, 6)
For i = 1 To bytRs
arrYm(i, 5) = "" ' 清除標(biāo)志
Next
For i = 1 To bytDs
arrDs(i, 1) = arrDw(i, 1) ' 抽簽用隊(duì)名數(shù)組
arrDs(i, 2) = arrDw(i, 2)
arrDs(i, 3) = arrDw(i, 3)
Next
Call P_grid
If blnZz Then
Command4.Enabled = False
bytZs = 0 ' Zs: 種子數(shù)
Set MyRsT = New Recordset ' T_pm 表
StrSQL = "Select * From " & StrT1 & _
" Where Ph='" & strPh & "' " & strTj1
MyRsT.Open StrSQL, cnnTce, adOpenKeyset, adLockOptimistic
bytZs = MyRsT![zs] ' bytZs: 種子數(shù)
Set MyRs2 = New Recordset ' T_zz 表
StrSQL = "Select a.Yh,b.Hm,b.Ym,a.Dh " & _
" From " & StrT2 & " a," & StrT4 & " b" & _
" Where a.Yh=b.Yh And a.Gh='" & strGh & "' And a.Ph='" & strPh & "'" & _
" Order By a.Xh"
MyRs2.Open StrSQL, cnnTce, adOpenKeyset, adLockOptimistic
bytZs = MyRs2.RecordCount ' bytZs: 種子數(shù)
If bytZs > 0 Then
ReDim arrZm(bytZs, 4) ' 種子數(shù)組
MyRs2.MoveFirst
For k = 1 To bytZs
strYh = MyRs2![yh]
arrZm(k, 1) = MyRs2![yh]
arrZm(k, 2) = MyRs2![Ym]
arrZm(k, 3) = MyRs2![Hm]
arrZm(k, 4) = MyRs2![Dh]
For i = 1 To bytRs
If strYh = arrYm(i, 1) Then
arrYm(i, 5) = k: Exit For ' 種子標(biāo)志
End If
Next
MyRs2.MoveNext
Next
ReDim arrZz(bytZs, 4)
Zm = Log(bytZs) / Log(2) ' Zm: 種子抽簽輪數(shù)
Call P_mmzz
Else
MsgBox " ??? ", 48, " Error": Exit Sub
End If
Else
MSFlexGrid1.Visible = True
Label10 = IIf(bytWs = 64, "64", "")
Frame2.Visible = True
Command8.SetFocus
End If
If blnYx Then Call P_yxcl ' 預(yù)選賽處理
If blnLk Then Call P_lkcl ' 輪空位處理
bytFs = bytRs - bytZs: ReDim arrFz(bytFs, 4)
For i = 1 To bytFs
arrFz(i, 0) = 2 * Zn + i ' 非種子數(shù)組
For j = 1 To bytRs
If Trim(arrYm(j, 5)) = "" Then
arrFz(i, 1) = arrYm(j, 1)
arrFz(i, 2) = arrYm(j, 2)
arrFz(i, 3) = arrYm(j, 3)
arrFz(i, 4) = arrYm(j, 4)
arrYm(j, 5) = "*": Exit For
End If
Next
Next
If bytWs = 64 Then Label10 = "64"
End Sub
Private Sub P_grid()
With MSFlexGrid1
.Clear
.Rows = bytWs + 1
.Cols = 6
.Height = 225 * IIf(bytWs > 32, 33, bytWs + 1) + 90
.Width = 4820
MSFlexGrid2.Left = .Left + .Width + 600
MSFlexGrid3.Left = MSFlexGrid2.Left
MSFlexGrid4.Left = MSFlexGrid2.Left
.Row = 0: .Col = 0: .Text = "位號(hào)": .ColWidth(0) = 470
.Col = 1: .Text = " 區(qū)號(hào)": .ColWidth(1) = 620
.Col = 2: .Text = "種子號(hào)": .ColWidth(2) = 620
.Col = 3: .Text = " 姓 名 ": .ColWidth(3) = 1000
.Col = 4: .Text = " 號(hào)碼 ": .ColWidth(4) = 620
.Col = 5: .Text = " 代 表 隊(duì)": .ColWidth(5) = 1400 - IIf(bytWs > 32, 270, 0)
w = bytWs / 16
For i = 1 To bytWs
arrWz(i) = i ' 位號(hào)
.TextMatrix(i, 0) = i & " "
k = Int((i + 15) / 16)
.TextMatrix(i, 1) = k & "/" & w & " "
Next
.MergeCol(1) = True
.MergeCells = flexMergeRestrictColumns ' 單元格合并
Frame2.Left = .Left + .Width + 600
End With
If bytWs = 64 Then
With MSFlexGrid2
.Clear
.Rows = 33
.Cols = 6
.Height = 225 * 33 + 90
.Width = 4980
.Row = 0: .Col = 0: .Text = "位號(hào)": .ColWidth(0) = 470
.Col = 1: .Text = " 區(qū)號(hào)": .ColWidth(1) = 620
.Col = 2: .Text = "種子號(hào)": .ColWidth(2) = 620
.Col = 3: .Text = " 姓 名 ": .ColWidth(3) = 1000
.Col = 4: .Text = " 號(hào)碼 ": .ColWidth(4) = 620
.Col = 5: .Text = " 代 表 隊(duì)": .ColWidth(5) = 1400 + 160
.MergeCol(1) = True
.MergeCells = flexMergeRestrictColumns ' 單元格合并
End With
End If
End Sub
Private Sub P_lkcl() ' 輪空位處理
With MSFlexGrid1
n = bytWs - bytRs ' n: 輪空位數(shù)
If n > bytZs Then
Call P_mzfb
For i = 1 To n
m = Val(.TextMatrix(Val(arrWh(i)), 0))
m = m + IIf(m Mod 2 = 1, 1, -1): .TextMatrix(m, 3) = " 輪空"
Next
Else
For i = 1 To .Rows - 1
m = Val(.TextMatrix(i, 2))
If m > 0 And m <= n Then
m = .TextMatrix(i, 0)
m = m + IIf(m Mod 2 = 1, 1, -1): .TextMatrix(m, 3) = " 輪空"
End If
Next
End If
End With
End Sub
Private Sub P_yxcl() ' 預(yù)選賽處理
ReDim arrYx(bytYs, 5)
With MSFlexGrid4
.Clear
.Rows = bytYs + 1
.Cols = 6
.Height = 225 * IIf(bytYs > 8, 9, bytYs + 1) + 90
.Width = 4980
.Top = 5020
Label9.Top = .Top - 300: Label9.Visible = True
.Left = MSFlexGrid3.Left
Label9.Left = .Left + 200
Label9 = "預(yù)選賽: " & bytYs
.Row = 0: .Col = 0: .Text = " 序號(hào)": .ColWidth(0) = 620
.Col = 1: .Text = " 位號(hào)": .ColWidth(1) = 620
.Col = 2: .Text = " 區(qū)號(hào)": .ColWidth(2) = 620
.Col = 3: .Text = " 姓 名 ": .ColWidth(3) = 1000
.Col = 4: .Text = " 號(hào)碼 ": .ColWidth(4) = 620
.Col = 5: .Text = " 代 表 隊(duì)": .ColWidth(5) = 1400 - IIf(bytYs > 8, 270, 0)
For i = 1 To bytYs
.TextMatrix(i, 0) = i & " "
Next
.MergeCol(2) = True
.MergeCol(1) = True
.MergeCells = flexMergeRestrictColumns ' 單元格合并
.Visible = True
Frame2.Top = .Top - Frame2.Height - 800
End With
With MSFlexGrid1
n = bytYs / 2 ' n: 預(yù)選賽位數(shù)
If n > bytZs Then
Call P_mzfb
For i = 1 To n
m = .TextMatrix(arrWh(i), 0)
m = m + IIf(m Mod 2 = 1, 1, -1): .TextMatrix(m, 3) = " X" & i
Next
Else ' n < bytZs
j = 0
For i = 1 To .Rows - 1
m = Val(.TextMatrix(i, 2))
If m > 0 And m <= n Then
m = .TextMatrix(i, 0): j = j + 1
m = m + IIf(m Mod 2 = 1, 1, -1): .TextMatrix(m, 3) = " X" & j
End If
Next
End If
k = 0
For i = 1 To .Rows - 1 '整理數(shù)組
If .TextMatrix(i, 3) Like "*X*" Then
k = k + 1
m = .TextMatrix(i, 0)
arrYx(k, 1) = m & " "
arrYx(k, 2) = .TextMatrix(m, 1)
arrYx(k, 3) = ""
arrYx(k, 4) = ""
arrYx(k, 5) = ""
k = k + 1
arrYx(k, 1) = m & " "
arrYx(k, 2) = .TextMatrix(m, 1)
arrYx(k, 3) = ""
arrYx(k, 4) = ""
arrYx(k, 5) = ""
End If
Next
End With
ReDim arrCq(bytDs)
m = bytDs
For i = 1 To bytDs
arrCq(i) = arrDw(i, 1)
Next
For i = 1 To bytYs ' 建立預(yù)選抽簽數(shù)組
l = F_ranu(m) ' 隨機(jī)抽出一隊(duì)代號(hào)
s = arrCq(l)
For j = bytRs To 1 Step -1
If arrYm(j, 4) = s And arrYm(j, 5) = "" Then
arrYx(i, 0) = " " & arrYm(j, 1)
arrYx(i, 3) = " " & arrYm(j, 2)
arrYx(i, 4) = " " & arrYm(j, 3)
arrYx(i, 5) = " " & F_fhdw(arrYm(j, 4))
arrYm(j, 5) = "Y" & n ' 預(yù)選標(biāo)志
Exit For
End If
Next
m = m - 1
For k = l To m ' 調(diào)整代號(hào)數(shù)組
arrCq(k) = arrCq(k + 1)
Next
Next
With MSFlexGrid4
For i = 1 To bytYs
For j = 1 To 5
.TextMatrix(i, j) = arrYx(i, j)
Next
Next
End With
End Sub
Private Sub Label10_Click() ' 顯示 33-64 位
If Label10 = "64" Then
m = 0
If Frame2.Visible Then
Frame2.Visible = False: m = 8
End If
With MSFlexGrid2
For i = 1 To .Rows - 1
.Row = i: MSFlexGrid1.Row = i + 32
For j = 0 To .Cols - 1
.Col = j: MSFlexGrid1.Col = j
.Text = MSFlexGrid1.Text
.CellBackColor = MSFlexGrid1.CellBackColor
Next
Next
.Visible = True
End With
Label10 = "32": Frame4.Visible = False
Else
If m = 8 Then Frame2.Visible = True
MSFlexGrid2.Visible = False
Label10 = "64": Frame4.Visible = True
End If
End Sub
Private Sub Command7_Click() ' 無(wú)種子處理
Frame2.Visible = False
For i = 0 To 4 ' 0.隨機(jī)分布
If Option2(i).Value Then ' 1.按序號(hào)分布
strYz = i: StrMsg = Trim(Option2(i).Caption) ' 2.參照種子方式分布
Exit For ' 3.均勻分布
End If ' 4.同隊(duì)選手分在相同的半?yún)^(qū)
Next
Call P_ww32
Label3 = "全部抽簽完畢 ..."
Command3.Caption = "返 回"
Command3.Enabled = True
Command4.Enabled = True
End Sub
Private Sub Command8_Click() ' 放棄
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -