vb编程代码vb编程代码
Public Class ,,,,
Dim chks(8, 8) As CheckBox
Dim o As Integer
Dim i, j As Integer
Dim P, U As Integer
Dim arr(9, 0) As Object
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
o = 0
For...
vb编程代码
Public Class ,,,,
Dim chks(8, 8) As CheckBox
Dim o As Integer
Dim i, j As Integer
Dim P, U As Integer
Dim arr(9, 0) As Object
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
o = 0
For i = 0 To 8
For j = 0 To 8
If chks(i, j) Is Nothing Then
chks(i, j) = New CheckBox()
End If
AddHandler chks(i, j).MouseUp, AddressOf Chk_MouseUp
chks(i, j).Appearance = Appearance.Button
chks(i, j).height = 25
chks(i, j).width = 25
chks(i, j).Top = i * 25 + 50
chks(i, j).left = j * 25
chks(i, j).text = ""
chks(i, j).tag = 0
chks(i, j).BackColor = Me.BackColor
chks(i, j).checked = False
chks(i, j).Enabled = True
chks(i, j).Font = New Font("Arial", 14, FontStyle.Bold)
Me.Controls.Add(chks(i, j))
Next
Next
Dim n As Integer = 0
Dim h As Integer = 0
Randomize()
Do While h < 10
P = Math.Floor(Rnd() * 9)
U = Math.Floor(Rnd() * 9)
If chks(P, U).Tag = 0 Then
arr(n, 0) = chks(P, U)
chks(P, U).Tag = 1
h = h + 1
n += 1
End If
Loop
Timer1.Enabled = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
End Sub
Private Sub Chk_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs)
Dim chk As CheckBox = CType(sender, CheckBox)
Dim m As Integer
If chk.Tag = 1 Then
For m = 0 To 9
arr(m, 0).BackColor = Color.Blue
Next
MsgBox("over ")
End
End If
Call autoopen(chk)
End Sub
Sub autoopen(ByVal chk As CheckBox)
Dim row As Integer = chk.Top / 25
Dim col As Integer = chk.Left / 25
Dim i, j As Integer
Dim sum As Integer = 0
For i = row - 1 To row + 1
For j = col - 1 To col + 1
If (i >= 0) And (i < 9) And (j >= 0) And (j < 9) Then
sum += chks(i, j).Tag
End If
Next
Next
chk.Text = sum
chk.Enabled = False
If sum = 0 Then
For i = row - 1 To row + 1
For j = row - 1 To row + 1
If (i >= 1) And (i <= 8) And (j >= 1) And (j <= 8)
Then
If chks(i, j).Text = "" Then
Call autoopen(chks(i, j))
End If
End If
Next
Next
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
o = o + 1
TextBox1.Text = o
End Sub
Private Sub Button1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles
Button1.MouseDoubleClick
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
本文档为【vb编程代码】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。