Dim x0 As Double, y0 As Double
Sub draws()
For i = 0 To 20 Step 2
Picture1.Line (i, 0)-(i, 20), vbWhite
Picture1.Line (0, i)-(20, i), vbWhite
Next
End Sub
Private Sub Form_Load()
Picture1.Scale (0, 0)-(20, 20)
x0 = 1
y0 = 1
Shape1.Shape = 3
Shape1.FillColor = vbBlack
Shape1.FillStyle = 0
Shape1.Move x0, y0, 2, 2
Picture1.AutoRedraw = True
draws
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
draws
End Sub
Private Sub Picture1_Mouseup(Button As Integer, Shift As Integer, X As Single, Y As Single)
draws
x0 = IIf(Int(X) Mod 2 = 0, Int(X) - 1, Int(X))
y0 = IIf(Int(Y) Mod 2 = 0, Int(Y) - 1, Int(Y))
Shape1.Move x0, y0, 2, 2
End Sub