Dim sngdrawwidth As Single '模块级变量,保存线条宽度
Private Sub Command1_Click()'刷新恢复
Form3.Cls
End Sub
Private Sub form_mousedown(button As Integer, shift As Integer, x As Single, y As Single)
If button = 1 Then '如果按下左键
CurrentX = x: CurrentY = y
sngdrawwidth = 1
DrawWidth = sngdrawwidth
End If
End Sub
Private Sub form_mousemove(button As Integer, shift As Integer, x As Single, y As Single)
Dim lngdrawcolor As Long
If button = 1 Then '使用不同颜色
If shift = 1 Then '同时按下shift键,颜色为红色
ingdrawcolor = RGB(255, 0, 0)
ElseIf shift = 2 Then '同时按下ctrl键,颜色为vbgreen
ingdrawcolor = vbGreen
ElseIf shift = 4 Then
ingdrawcolor = &HFF000
End If
sngdrawwidth = sngdrawwidth + 0.1 '加宽线条
DrawWidth = sngdrawwidth
Line -(x, y), ingdrawcolor '画线
End If
End Sub