|
-
Sep 19th, 2001, 01:01 PM
#1
Thread Starter
New Member
-
Sep 19th, 2001, 01:04 PM
#2
Frenzied Member
hmmmmm
do you mean the draw function?
-
Sep 19th, 2001, 01:11 PM
#3
Frenzied Member
heres a drawing function
insert a PictureBox on your form
then paste this code in the app:
Dim DrawNow As Boolean
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawNow = True
Picture1.Line (X, Y)-(X, Y)
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If DrawNow = True Then
Picture1.Line -(X, Y), vbRed
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawNow = False
End Sub
-
Sep 19th, 2001, 01:17 PM
#4
Frenzied Member
Use the Line function! Here's some code:
VB Code:
Dim X1 As Long, Y1 As Long
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
X1 = X
Y1 = Y
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Line (X1, Y1)-(X, Y)
End Sub
Click and drag on the picturebox, it'll draw a line 
You can also set some properties in the picturebox so it paints in another color, or with another line size
-
Sep 19th, 2001, 01:17 PM
#5
Thread Starter
New Member
No I mean the Line function which draws only straight lines. When the left mousebutton is clicked and held, then dragged to a new location, there is a straight line from where the mouse clicked to where the mouse is after it's moved.
-
Sep 19th, 2001, 01:34 PM
#6
Frenzied Member
ok......
use 2 pictureboxes
set picture1 and picture2's autoredraw to true
set picture2's visible to false
insert code:
Dim X1 As Long, Y1 As Long
Dim DrawNow As Boolean
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawNow = True
X1 = X
Y1 = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If DrawNow = True Then
Picture1.Cls
Picture1.Line (X1, Y1)-(X, Y)
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawNow = False
Picture2.Picture = Picture1.Image
Picture1.Picture = Picture2.Picture
End Sub
Last edited by cyborg; Sep 20th, 2001 at 08:58 AM.
-
Sep 19th, 2001, 05:24 PM
#7
Frenzied Member
Yeah, but that has a small problem... you'll erase all the other lines whenever you create a new one...
-
Sep 20th, 2001, 08:54 AM
#8
Frenzied Member
nope! not if you set autoredraw to true on both pictureboxes
-
Sep 20th, 2001, 08:57 AM
#9
Frenzied Member
-
Sep 20th, 2001, 04:37 PM
#10
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|