Dear Friends
Can any body tell me how to draw a rectangle on a picture box using mouse .
Regards
kishore
Printable View
Dear Friends
Can any body tell me how to draw a rectangle on a picture box using mouse .
Regards
kishore
VB Code:
Private FirstClick As Boolean Private P1 As Point Private P2 As Point Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown FirstClick = Not FirstClick If FirstClick Then P1 = New Point(e.X, e.Y) Else P2 = New Point(e.X, e.Y) Pic1.CreateGraphics.DrawRectangle(Pens.Black, P1.X, P1.Y, P2.X, P2.Y) End If End Sub