📄 form0901.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "使用鼠标画图"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
Height = 2295
Left = 1200
ScaleHeight = 2235
ScaleWidth = 3195
TabIndex = 3
Top = 360
Width = 3255
End
Begin VB.Frame Frame1
Height = 2175
Left = 120
TabIndex = 0
Top = 360
Width = 855
Begin VB.CommandButton Command3
Caption = "清除"
Height = 375
Left = 120
TabIndex = 4
Top = 1560
Width = 615
End
Begin VB.CommandButton Command2
Caption = "方块"
Height = 375
Left = 120
TabIndex = 2
Top = 960
Width = 615
End
Begin VB.CommandButton Command1
Caption = "直线"
Height = 375
Left = 120
TabIndex = 1
Top = 360
Width = 615
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim C1 As Integer
Dim X1 As Integer, Y1 As Integer
Private Sub Command1_Click()
'单击直线按钮
C1 = 1
End Sub
Private Sub Command3_Click()
'单击清除按钮
Picture1.Cls
End Sub
Private Sub Command2_Click()
'单击方块按钮
C1 = 2
End Sub
Private Sub Form_Load()
'装载窗体
C1 = 0
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'在图片框中按下鼠标键
If Button = 1 Then
X1 = X
Y1 = Y
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
'在图片框中释放鼠标键
If Button = 1 Then
Select Case C1
Case 1
Picture1.Line (X1, Y1)-(X, Y)
Case 2
Picture1.Line (X1, Y1)-(X, Y), , B
End Select
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -