📄 checks.frm
字号:
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 29
Left = 2160
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 28
Top = 2040
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 28
Left = 1680
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 27
Top = 2040
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 27
Left = 1200
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 26
Top = 2040
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 26
Left = 720
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 25
Top = 2040
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 25
Left = 240
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 24
Top = 2040
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 23
Left = 3600
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 23
Top = 2520
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 24
Left = 3120
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 22
Top = 2520
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 21
Left = 2640
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 21
Top = 2520
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 22
Left = 2160
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 20
Top = 2520
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 19
Left = 1680
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 19
Top = 2520
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 20
Left = 1200
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 18
Top = 2520
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 17
Left = 720
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 17
Top = 2520
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 18
Left = 240
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 16
Top = 2520
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 16
Left = 3600
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 15
Top = 3000
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 15
Left = 3120
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 14
Top = 3000
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 14
Left = 2640
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 13
Top = 3000
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 13
Left = 2160
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 12
Top = 3000
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 12
Left = 1680
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 11
Top = 3000
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 11
Left = 1200
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 10
Top = 3000
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 10
Left = 720
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 9
Top = 3000
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 9
Left = 240
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 8
Top = 3000
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 7
Left = 3600
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 7
Top = 3480
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 8
Left = 3120
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 6
Top = 3480
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 5
Left = 2640
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 5
Top = 3480
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 6
Left = 2160
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 4
Top = 3480
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 3
Left = 1680
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 3
Top = 3480
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 4
Left = 1200
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 2
Top = 3480
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 495
Index = 1
Left = 720
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 1
Top = 3480
Width = 495
End
Begin VB.PictureBox picSquare
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Index = 2
Left = 240
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 0
Top = 3480
Width = 495
End
End
Attribute VB_Name = "frmChecker"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 12.10
' Demonstrating manual drag-and-drop
Option Explicit ' General declaration
Dim mCurrentCell As Integer ' General declaration
Private Sub Form_Load()
Dim x As Integer
mCurrentCell = 2 ' Lower left corner
For x = 1 To 64
If x Mod 2 Then
picSquare(x).Picture = LoadPicture("d:\images\ch12\" & _
"w_marble.jpg")
Else
picSquare(x).Picture = LoadPicture("d:\images\ch12\" & _
"b_marble.jpg")
End If
Next x
picSquare(2).Picture = LoadPicture("d:\images\ch12\" & _
"b_knight.jpg")
End Sub
Private Sub picSquare_MouseDown(Index As Integer, _
Button As Integer, _
Shift As Integer, _
x As Single, Y As Single)
' If on the PictureBox displaying the image
' then enable dragging.
If Index = mCurrentCell Then
picSquare(mCurrentCell).Drag vbBeginDrag
End If
End Sub
Private Sub picSquare_DragOver(Index As Integer, _
Source As Control, _
x As Single, Y As Single, _
State As Integer)
' Display icon while dragging over a PictureBox
picSquare(Index).DragIcon = LoadPicture("d:\images" & _
"\ch12\knight.cur")
End Sub
Private Sub picSquare_DragDrop(Index As Integer, _
Source As Control, _
x As Single, Y As Single)
' Draw image at new position
If Index Mod 2 Then
picSquare(Index).Picture = LoadPicture("d:\images\ch" & _
"12\w_knight.jpg")
Else
picSquare(Index).Picture = LoadPicture("d:\images\ch" & _
"12\b_knight.jpg")
End If
' Remove last image only if the drop is at
' a different location.
If mCurrentCell <> Index Then
If Source.Index Mod 2 Then
Source.Picture = LoadPicture("d:\images\ch12" & _
"\w_marble.jpg")
Else
Source.Picture = LoadPicture("d:\images\ch12" & _
"\b_marble.jpg")
End If
End If
' Update current image position
mCurrentCell = Index
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -