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]
Re: Drawing square by mouse
Thanks to Aaron. I ll try that way.