Lines in a picturebox disappeared when changing the active window
Drawing inside a picture box, if I minimize the window or change the application with Alt-Tab, when I return to the initial picture's window, the painted area disappeared.
Setting Autoredraw to True, it doesn't paint.
To solve this, I've made the following mess:
Is there any better way to maintain all lines and painted areas?
VB Code:
Picture1.ScaleMode = vbPixels
Picture1.AutoRedraw = False
Picture1.FillStyle = 0
Picture1.Enabled = True
Picture2.AutoRedraw = True
Picture2.ScaleMode = vbPixels
Picture2.AutoSize = True
picture2.visible=false
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ExtFloodFill Picture1.hDC, X, Y, GetPixel(Picture1.hDC, X, Y), FLOODFILLSURFACE
Picture2.Width = Picture1.Width
Picture2.Height = Picture1.Height
BitBlt Picture2.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleWidth, Picture1.hDC, 0, 0, vbSrcCopy
Picture2.Picture = Picture2.Image
Picture1.Picture = Picture2.Image
End Sub