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:
  1. Picture1.ScaleMode = vbPixels
  2. Picture1.AutoRedraw = False
  3. Picture1.FillStyle = 0
  4. Picture1.Enabled = True
  5. Picture2.AutoRedraw = True
  6. Picture2.ScaleMode = vbPixels
  7. Picture2.AutoSize = True
  8. picture2.visible=false
  9.  
  10.  
  11. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  12. ExtFloodFill Picture1.hDC, X, Y, GetPixel(Picture1.hDC, X, Y), FLOODFILLSURFACE
  13. Picture2.Width = Picture1.Width
  14. Picture2.Height = Picture1.Height
  15. BitBlt Picture2.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleWidth, Picture1.hDC, 0, 0, vbSrcCopy
  16. Picture2.Picture = Picture2.Image
  17. Picture1.Picture = Picture2.Image
  18. End Sub