How can i draw rectangles in a picture wich has an image???
I want to draw rectangles when i clickon the pictureBox
i know i have to use : e.Graphics.FillRectangle(Brushes.White, New Rectangle(X, Y, 10, 10))
but how?
Thank's
djzar2004 Thursday, July 12, 2007 9:40 AM
Be careful using the 'CreateGraphics' in that manner - if you minimise the window and maximise it - the rectangles will disappear? Check out this article for a cleaner approach -> http://www.bobpowell.net/picturebox.htm
Sub pbMapa_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pbMapa.MouseDown
X = e.X
Y = e.Y
End Sub
Private Sub pbMapa_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pbMapa.MouseUp
Dim g As Graphics = pbMapa.CreateGraphics()
g.FillRectangle(Brushes.White,
New Rectangle(X, Y, 10, 10))
End Sub
djzar2004 Thursday, July 12, 2007 9:48 AM
Be careful using the 'CreateGraphics' in that manner - if you minimise the window and maximise it - the rectangles will disappear? Check out this article for a cleaner approach -> http://www.bobpowell.net/picturebox.htm