HI I am using the Graphics to paint to a a picture box but if i minimise my screen the picture disappears is there anyway i can fix this?? Please Help!! here is my code:
PLease Help me it will be deeply appreciated!!
Dim g As Graphics = Me.PictureBox3.CreateGraphics()
g.Clear(Me.PictureBox3.BackColor)
Dim curImage As Image = Drawing.Image.FromFile(Application.StartupPath + "\Resources\South1.png")
g.DrawImage(curImage, 0, 0, curImage.Width, curImage.Height)
Dim i As Integer
For i = 0 To Rds.Tables(0).Rows.Count - 1
Dim ave As Double
Dim x, y, w, h As Integer
Dim faultcounts As Integer
faultcounts = Convert.ToInt64(Rds.Tables(0).Rows.Item(i)("Expr1" ))
ave = (faultcounts / totals)
x = Rds.Tables(0).Rows.Item(i)("XCoordinate")
y = Rds.Tables(0).Rows.Item(i)("YCoordinate")
w = Rds.Tables(0).Rows.Item(i)("WidthHM")
h = Rds.Tables(0).Rows.Item(i)("HeightHM")
If (ave > 0.25) Then
Dim rectan As New Rectangle(x, y, w, h)
g.FillRectangle(New SolidBrush(Color.FromArgb(140, 255, 0, 0)), rectan)
rectan.Y += 60
ElseIf (ave < 0.25 And ave > 0.1) Then
Dim rectan1 As New Rectangle(x, y, w, h)
g.FillRectangle(New SolidBrush(Color.FromArgb(140, 255, 255, 0)), rectan1)
rectan1.Y += 60
ElseIf (ave < 0.1 Or ave = Nothing) Then
Dim rectan2 As New Rectangle(x, y, w, h)
g.FillRectangle(New SolidBrush(Color.FromArgb(140, 0, 0, 255)), rectan2)
rectan2.Y += 60
End If
Next
g.Dispose()
End Sub