Drawing disappears on modal form
-
I have:
For i = 0 To 100 'TextOut GetWindowDC(GetActiveWindow), 50 + 10 * i, 50, str, Len(str) RetVal = Rectangle(GetWindowDC(GetActiveWindow), 20 + 10 * i, 40, 30 + 10 * i, 50) ' ProgressBar1.Value = i Next
on a modal form. Works ok. But, if you cover the running app with another screen and then show the app again, the rectangles have vanished! I tried
' Form1.AutoRedraw = True
, but this makes the form come up with no rectangles, and when you close the app, task manager says its still running. (I call that a 'crash' I dont know what that situation is called'. Thanks, ns
-
I have:
For i = 0 To 100 'TextOut GetWindowDC(GetActiveWindow), 50 + 10 * i, 50, str, Len(str) RetVal = Rectangle(GetWindowDC(GetActiveWindow), 20 + 10 * i, 40, 30 + 10 * i, 50) ' ProgressBar1.Value = i Next
on a modal form. Works ok. But, if you cover the running app with another screen and then show the app again, the rectangles have vanished! I tried
' Form1.AutoRedraw = True
, but this makes the form come up with no rectangles, and when you close the app, task manager says its still running. (I call that a 'crash' I dont know what that situation is called'. Thanks, ns
If you add your code to the subroutine
Form_Paint()
I think you should be able to see your rectangles when redisplaying your form. This worked for me.Private Sub Form_Paint()
For i = 0 To 100
'TextOut GetWindowDC(GetActiveWindow), 50 + 10 * i, 50, str, Len(str)
RetVal = Rectangle(GetWindowDC(GetActiveWindow), 20 + 10 * i, 40, 30 + 10 * i, 50)
'ProgressBar1.Value = i
NextEnd Sub
Nick Parker
**So like children pointers should be left to grown ups. - Norm Alomond
**