I played a little further myself. I now have AutoRedraw=False and using the
Paint event to call the drawing routine (same way you do it). I swapped the
paintpicture for some APIs to increase speed and all is well. Except, the
control does flicker a bit, even after compiling. The drawing routine paints
the entire control each time so there is no need to worry about what was
there before.
>I played a little further myself. I now have AutoRedraw=False and using the
>Paint event to call the drawing routine (same way you do it). I swapped the
>paintpicture for some APIs to increase speed and all is well. Except, the
>control does flicker a bit, even after compiling. The drawing routine paints
>the entire control each time so there is no need to worry about what was
>there before.
Yes, the flickering appears to be because one is drawing something,
then drawing over it, which is profoundly annoying
I am toying with the idea of doing all painting to an invisible
Picturebox, then slapping that on the UserControl
- all within the Paint Event
- I think all the Print, PSet and Line statements are being
immediately processed when AutoRedraw = False
I've always reckoned that the PaintPicture was pretty fast
However I think that stuff like FillBox and SetPixel do not trigger an
immediate update, so maybe an 'All API' solution would be flicker free
I'll experiment with the invisible Picturebox method tomorrow
Mike Williams - 07 Mar 2004 16:41 GMT
> However I think that stuff like FillBox and SetPixel do not
> trigger an immediate update, so maybe an 'All API' solution
> would be flicker free . . .
Most of the VB drawing and painting functions trigger an update on on
Autoredraw Picture Box, but the various alternative API routines do not. So
if you use only API drawing and painting methods then there will be no
update at all until you specifically trigger one (Refresh or whatever). Even
a single "VB" method (such as SetPixel, for example) in an otherwise "All
API" drawing routine will trigger an update for the lot. If you want no
updates until you are ready for one then you should use nothing but API
methods.
Mike
Lindsay - 07 Mar 2004 17:48 GMT
Ah! The picture was drawn with APIs and then I printed some text with Print.
I just discovered an interesting error with all this. If I draw on a User
control (method seems irrelevant) and the put that on a form that has been
drawn on and then try to redraw the user control, I get a Blue Screen error!
Example:
User control has been drawn with Paintpicture via Paint event with
AutoRedraw=False. The form is drawn with Paintpicture via Form_Load
event(just once needed) with AutoRedraw=True. The User control triggers a
_Click event when clicked on which also triggers the Paint event within the
user control. As soon as I click the user control, Windows shuts down. The
error shows the file: Win32.sys (I think, from memory).
Quite bizarre!!
> > However I think that stuff like FillBox and SetPixel do not
> > trigger an immediate update, so maybe an 'All API' solution
[quoted text clipped - 10 lines]
>
> Mike
Lindsay - 07 Mar 2004 19:06 GMT
I tried an 'All API' solution but it still flickers. So, I tried your idea
(hope you don't mind me nicking it) of an invisible picturebox using APIs
and it works! The APIs I'm using are StretchBlt and TextOut.
> >I played a little further myself. I now have AutoRedraw=False and using the
> >Paint event to call the drawing routine (same way you do it). I swapped the
[quoted text clipped - 18 lines]
>
> I'll experiment with the invisible Picturebox method tomorrow