|
-
November 18th, 1999, 03:21 PM
#1
Drawing square by mouse
Hi to everyone who cared about my message.
I want to know how to delete lines in my drawing program.
Since I try to draw line, I do like this:
1. As mouse down, it is the start x and y point.
2. As mouse move, draw a line to the point that the mouse is located.
Here is a problem, As long as mouse is moving or until mouse-up, lines I have created should go away. The program just leaves the lines there. It should be just like MS paint.
If you understood my english, and know a good idea for this.
Please help me.
-
November 19th, 1999, 12:32 AM
#2
Re: Drawing square by mouse
Try using the Invert Pen to create a RubberBand Effect, eg.
private oX as Integer
private oY as Integer
private lX as Integer
private lY as Integer
private Sub Form_Load()
Picture1.ScaleMode = vbPixels
End Sub
private Sub Picture1_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)
If Button = vbLeftButton then
oX = X
oY = Y
Picture1.DrawMode = vbInvert
End If
End Sub
private Sub Picture1_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single)
If Button = vbLeftButton then
Picture1.Line (oX, oY)-step(lX - oX, lY - oY), , B
Picture1.Line (oX, oY)-step(X - oX, Y - oY), , B
End If
lX = X
lY = Y
End Sub
private Sub Picture1_MouseUp(Button as Integer, Shift as Integer, X as Single, Y as Single)
Picture1.Line (oX, oY)-step(lX - oX, lY - oY), , B
Picture1.DrawMode = vbCopyPen
Picture1.Line (oX, oY)-step(X - oX, Y - oY), , B
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
November 19th, 1999, 10:30 AM
#3
Re: Drawing square by mouse
Thanks to Aaron. I ll try that way.
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
|