Reputation: 67
In a form I have a picturebox and Rectangle structure,
Dim RcDraw As Rectangle
I fill the x and y property of this structure
RcDraw.X = 10
RcDraw.Y = 10
and I need to execute the paint event of the picturebox in order to see the rectangle in the picturebox, how I can do this?
Upvotes: 0
Views: 130
Reputation: 54552
Use the Invalidate Method of the PictureBox
, you also need to assign the Height
and Width
to your rectangle
PictureBox1.Invalidate()
Then in your Picturebox's Paint EventHandler
you would do something like this.
e.Graphics.DrawRectangle(Pens.Black, RcDraw)
or if you want it filled.
e.Graphics.FillRectangle(Brushes.Black, RcDraw)
Upvotes: 1