B
bassi.carlo
I use a PictureBox to allow users to draw fixed size rectangles.
User click the mouse inside PictureBox and the program read where
mouse is and collect infomations in an array.
Dim Rcs() as Integer 'Rectangles array
Then I call a function who draw rectangles inside PIctureBox1 using
array informations
Private Sub DrawRects()
Dim gr As Graphics = PictureBox1.CreateGraphics
for i = 0 to Rects.GetLength(0)
gr.FillRectangle(Brushes.Red, New System.Drawing.Rectangle(Rcs(i,
0), Rcs(i, 1),Rcs(i, 2),Rcs(i, 0))
next i
End Sub
Everything work well, my problem is if I switch to another application
when I go back my picture box is completely white.
And the same If I resize window.
I tried to put I call to DrawRects function in PictureBox1_Paint event
but don't solve my problem, why?
Thanx in advance
Carlo
User click the mouse inside PictureBox and the program read where
mouse is and collect infomations in an array.
Dim Rcs() as Integer 'Rectangles array
Then I call a function who draw rectangles inside PIctureBox1 using
array informations
Private Sub DrawRects()
Dim gr As Graphics = PictureBox1.CreateGraphics
for i = 0 to Rects.GetLength(0)
gr.FillRectangle(Brushes.Red, New System.Drawing.Rectangle(Rcs(i,
0), Rcs(i, 1),Rcs(i, 2),Rcs(i, 0))
next i
End Sub
Everything work well, my problem is if I switch to another application
when I go back my picture box is completely white.
And the same If I resize window.
I tried to put I call to DrawRects function in PictureBox1_Paint event
but don't solve my problem, why?
Thanx in advance
Carlo