|
From: Patrick Weidener on 16 Jul 2008 06:46 I am struggeling with the PAINT events. When I have autoredraw set to TRUE, VB6 handles the image and redraws it when needed. I learnt that this is no good programming, and that I should manage the redrawing myself, and so I did. But I'm a bit confused... On UserControl_Resize: Should I draw everything I want to draw onto my memory DC? On UserControl_Paint: Should I blit the memory DC on the usercontrol DC?
From: Mike Williams on 16 Jul 2008 15:17 "Patrick Weidener" <pawei_nospom(a)gmx.net> wrote in message news:eYLsVFz5IHA.1592(a)TK2MSFTNGP04.phx.gbl... > I am struggeling with the PAINT events. When I have autoredraw > set to TRUE, VB6 handles the image and redraws it when needed. > I learnt that this is no good programming, and that I should manage > the redrawing myself, and so I did . . . Why do you think it is not good programming? Sometimes an Autoredraw picturebox is a good solution and sometimes it is not. It all depends on exactly what you are drawing into the picturebox and what your code is actually doing. One good thing about an Autoredraw picturebox is that it will automatically handle the "dirty rectangle" for you, redrawing only that part of the picturebox which has become "dirty", which when you are moving rather than resizing is often just a very small rectangle, depending on what triggered the redraw. Performing that same task redrawing only the dirty rectangle from a buffer) in the Paint event of a non Autoredraw picturebox requires you to subclass the event in order to determine the dirty rectangle, the details of which have been effectively lost once the Paint event itself actually executes. Basically, as with most things, its "horses for courses" and it all depends on exactly what task your code is performing. I certainly would not automatically write off a specific method as a matter of principle. Every option needs to be considered and for some tasks method A is better or easier, and sometimes both, than method B while for other tasks the reverse is true. Mike
From: Patrick Weidener on 16 Jul 2008 15:37 Thank you, Mike!
From: Jeff Johnson on 17 Jul 2008 15:40 "Mike Williams" <mikea(a)whiskyandCoke.com> wrote in message news:e$Dmbi35IHA.5108(a)TK2MSFTNGP06.phx.gbl... > Basically, as with most things, its "horses for courses" And this is my New British Idiom of the Day.
|
Pages: 1 Prev: Off topic: Kind of game sprite problem Next: Return Code |