|
-
Apr 22nd, 2000, 04:45 AM
#1
Can someone tell me the how to make it so that when the mouse is clicked in a picture box, and held down, it will draw a line wherever the mouse is moved. If you could give me the code, or a link to a tutorial, it would greatly apprciated. Thanks...
-
Apr 22nd, 2000, 05:02 AM
#2
I think you mean the line is only inside of the picturebox, so here's something: (not tested and no pset)
Dim OldX as integer
Dim OldY as integer
Private Sub Picture1_MouseDown(Button as integer, Shift as integer, X as integer, Y as integer)
If Button <> 1 then Exit sub
OldX=X
OldY=Y
End Sub
Private Sub Picture1_MouseMove(Button as integer, Shift as integer, X as integer, Y as integer)
If Button <> 1 then Exit sub
Picture1.Line (OldX, OldY)-(X,Y)
OldX=X
OldY=Y
End Sub
Hope this is what you searched for. If you want that the picture won't be rubbed away, put Autoredraw on.
-
Apr 22nd, 2000, 05:16 AM
#3
I think im wrong...
I dont think im doing it right, could you go a little more in depth?
-
Apr 22nd, 2000, 05:54 AM
#4
transcendental analytic
Try this:
Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
CurrentX = X: CurrentY = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then Line -(X, Y)
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 22nd, 2000, 07:12 AM
#5
Thanks
Thanks, that was exactly what i was looking for!
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
|