Simple mouse drawing program.
Simple mouse drawing program.
API Declarations
zip file available with all this info if you
don't want to use this paste method
Rate Simple mouse drawing program.
(1(1 Vote))
'No declarations
'You need these controls:
'(I've used default names)
'
'3 command buttons
'3 option buttons
'3 lines (their drawwidths set to illustrate the 3 available drawing widths)
'2 menus
'1 common dialog
'1 picture box
'1 label
Private Sub Command1_Click()
CommonDialog1.ShowColor
Picture1.ForeColor = CommonDialog1.Color
End Sub
Private Sub Command2_Click()
CommonDialog1.ShowColor
Picture1.BackColor = CommonDialog1.Color
End Sub
Private Sub Command3_Click()
Picture1.Cls
End Sub
Private Sub Form_Load()
End Sub
Private Sub mnuDraw_Click()
msg = "Just move mouse around to draw."
response = MsgBox(msg, vbOKOnly, "Draw")
End Sub
Private Sub mnuMouse_Click()
msg1 = "Holding down right mouse button suspends drawing."
msg2 = Chr(13) & Chr(10)
msg3 = "Holding down left mouse button erases."
msg = msg1 & msg2 & msg3
response = MsgBox(msg, vbOKOnly, "Mouse")
End Sub
Private Sub mnuSavePic_Click()
msg = "Picture will be saved to c:\ as drawing.bmp" & Chr(13) & Chr(10) & "WARNING WILL ROBINSON!!! Save function will overwrite any existing file by that name!!!"
response = MsgBox(msg, vbOKCancel, "You've been warned!")
If response = 2 Then Exit Sub
SavePicture Picture1.Image, "c:\drawing.bmp"
End Sub
Private Sub Option1_Click()
Picture1.DrawWidth = 1
End Sub
Private Sub Option2_Click()
Picture1.DrawWidth = 2
End Sub
Private Sub Option3_Click()
Picture1.DrawWidth = 3
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then Exit Sub
If Button = 1 Then Picture1.ForeColor = Picture1.BackColor
Picture1.PSet (X, Y)
End Sub
Simple mouse drawing program. Comments
No comments yet — be the first to post one!
Post a Comment