📄 vb2.txt
字号:
Private x1, y1 As Single
Private fag As Integer
Private m As Integer
Private n As Integer
Private drawcolor As Long
Private Sub bangzhu_Click()
Form2.Show
End Sub
Private Sub baocun_Click()
On Error GoTo Handle
cdg1.Filter = "bmp文件(*.bmp)|*.bmp"
cdg1.Show save
If cdg1.FileName <> "" Then
SavePicture Picture3.Image, cdg1.FileName
Exit Sub
End If
Handle:
MsgBox "保存文件错误"
End Sub
Private Sub beijingse_Click()
cdg1.ShowColor
Picture3.BackColor = cdg1.Color
Picture1.BackColor = cdg1.Color
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 1
flag = 2
Picture3.DrawWidth = 1
Option8(0).Value = True
Case 2
flag = 4
Picture3.DrawWidth = 1
Option8(0).Value = True
Case 3
flag = 0
Picture3.DrawWidth = 1
Option9(0).Value = True
Case 4
flag = 5
Picture3.DrawWidth = 1
Picture3.FillStyle = 1
Option8(0).Value = True
Case 5
flag = 5
Picture3.DrawWidth = 1
Option8(0).Value = 1
Case 6
flag = 7
Picture3.DrawWidth = 1
Picture3.FillStyle = 1
Option8(0).Value = 1
Case 7
flag = 7
Picture3.DrawWidth = 1
Option8(0).Value = 1
Case 8
flag = 9
Picture3.DrawWidth = 1
Picture3.FillStyle = 1
Option8(0).Value = 1
Case 9
flag = 9
Picture3.DrawWidth = 1
Option8(0).Value = 1
Case 10
flag = 18
Case 11
flag = 11
End Select
End Sub
Private Sub Command2_Click()
Picture3.Cls
End Sub
Private Sub Command3_Click()
flag = 89
End Sub
Private Sub Command4_Click()
cdg1.Action = 1
End Sub
Private Sub Command5_Click()
Dim i As Integer
i = MsgBox("是否退出", vbExclamation + vbYseNo)
If i = vbYes Then
End
Else
Picture3.SetFocus
End If
End Sub
Private Sub Command6_Click()
Dim i, j, k, l
Randomize
Picture3.DrawWidth = 10
For i = 1 To 200
j = Int(Rnd * Picture3.Width)
k = Int(Rnd * Picture3.Width)
l = Int(Rnd * Picture3.Width)
Picture3.PSet (j, k), QBColor(1)
Next i
End Sub
Private Sub Command7_Click()
cdg1.Action = 2
End Sub
Private Sub dakai_Click()
On Error GoTo Handle
cdg1.Filter = "all file(*.*)|*.*|bmp 文件(*.bmp)|*.bmp|图标文件(*.ico)|*.ico|位图文件(*.wmf)|*.wmf"
cdg1.FilterIndex = 2
cdg1.ShowOpen
Picture3.Picture = LoadPicture(cdg1.FileName)
Exit Sub
Handle:
MsgBox "打开文件错误"
End Sub
Private Sub Form_Load()
Picture3.DrawWidth = 1
drwcolor = Picture2.BackColor
Picture3.DrawWidth = 1
m = Picture3.Width
n = Picture3.Height
flag = 0
End Sub
Private Sub lingcunwei_Click()
On Error GoTo Handle
cdg1.Filter = "jpeg 文件(*.jpeg)|*.jpeg|bmp文件(*.bmp)|*.bmp|图标文件(*.ico)|*.ico|位图文件(*.wmf)|*.wmf"
cdg1.showsave
If cdg1.FileName <> "" Then
SavePicture Picture3.Image, cdg1.FileName
Exit Sub
End If
Handle:
MsgBox "保存文件错误"
End Sub
Private Sub Option1_Click()
If Option1.Value = True Then
Picture3.FillStyle = 1
End If
End Sub
Private Sub Option2_Click()
If Option1.Value = True Then
Picture3.FillStyle = 2
End If
End Sub
Private Sub Option3_Click()
If Option1.Value = True Then
Picture3.FillStyle = 3
End If
End Sub
Private Sub Option4_Click()
If Option1.Value = True Then
Picture3.FillStyle = 4
End If
End Sub
Private Sub Option5_Click()
If Option1.Value = True Then
Picture3.FillStyle = 5
End If
End Sub
Private Sub Option6_Click()
If Option1.Value = True Then
Picture3.FillStyle = 6
End If
End Sub
Private Sub Option7_Click()
If Option1.Value = True Then
Picture3.FillStyle = 7
End If
End Sub
Private Sub Option8_Click(Index As Integer)
Select Case Index
Case 0
Picture3.DrawWidth = 1
Case 1
Picture3.DrawWidth = 3
Case 2
Picture3.DrawWidth = 5
Case 3
Picture3.DrawWidth = 10
End Select
End Sub
Private Sub Option9_Click(Index As Integer)
Select Case Index
Case 0
Picture3.DrawWidth = 5
Case 1
Picture3.DrawWidth = 8
Case 2
Picture3.DrawWidth = 15
Case 3
Picture3.DrawWidth = 20
End Select
End Sub
Private Sub Picture1_Click()
cdg1.Show Color
Picture3.ForeColor = cdg1.Color
Picture1.ForeColor = cdg1.Color
End Sub
Private Sub Picture2_Click()
cdg1.ShowColor
Picture3.ForeColor = cdg1.Color
Picture2.BackColor = cdg1.Color
End Sub
Private Sub Picture3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If mutton = 1 Then
drawcolor = Picture2.BackColor
Else
drawcolor = Picture1.BackColor
End If
x1 = X
y1 = Y
Select Case flag
Case 0
If Button = 1 Then
Picture3.Line (x1, y1)-(X, Y), drawcolor
x1 = X
y1 = Y
End If
Case 89
Picture2.BackColor = Picture3.Point(X, Y)
End Select
End Sub
Private Sub Picture3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case flag
Case 0
If Button = 1 Then
Picture3.Line (x1, y1)-(X, Y), Picture1.BackColor
x1 = X
y1 = Y
End If
Case 4
If Button = 1 Then
Picture3.Line (x1, y1)-(X, Y), drawcolor
x1 = X
y1 = Y
End If
Case 5
Case 6
Case 7
Case 8
Case 9
Case 10
If Button = 1 Then
Picture3.Line (x1, y1)-(X, Y), drawcolor
x1 = X
y1 = Y
End If
End Select
End Sub
Private Sub Picture3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case flag
Case 1
Case 2
Picture3.Line (x1, y1)-(X, Y), drawcolor
Case 8
Case 9
Picture3.Line (x1, y1)-(X, Y), drawcolor
Case 6
Case 7
Picture3.Circle (x1, y1), Sqr((x1 - X) * (x1 - X) + (y1 - Y) * (y1 - Y)), drawcolor, , , (Y - y1) / (X - x1)
Case 4
Case 5
Picture3.Circle (x1, y1), Sqr((x1 - X) * (x1 - X) + (y1 - Y) * (y1 - Y)), drawcolor
Case 9
Picture3.PSet (x1, y1), drawcolor
Case 11
Dim colorcode As Integer
Dim i As Integer
Picture3.Scale (-200, 200)-(200, -200)
For i = 1 To 100 Step 5
X = 200 * Rnd
Y = 200 * Rnd
If Rnd < 0.5 Then X = 0 - X
If Rnd < 0.5 Then Y = 0 - Y
colorcode = 15 * Rnd
Picture3.Line (0, 0)-(X, Y), drawcolor
Next i
Case 18
Picture3.Scale (-200, 200)-(200, -200)
x1 = X: y1 = Y
X2 = x1 - 500
Y2 = y1 - 500
Picture3.Line (x1, y1)-(X2, Y2)
End Select
End Sub
Private Sub Picture4_Click()
cdg2.ShowColor
Picture4.BackColor = cdg2.Color
Picture3.FillStyle = cdg2.Color
End Sub
Private Sub qianjingse_Click()
cdg1.ShowColor
Picture3.ForeColor = cdg1.Color
Picture3.BackColor = cdg1.Color
End Sub
Private Sub tuichu_Click()
Dim i As Integer
i = MsgBox("是否退出", vbExclamation + vbYesNo)
If i = vbyse Then
End
Else
Picture3.SetFocus
End If
End Sub
Private Sub xinjian_Click()
Picture3.Cls
Picture3.MousePointer = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -