Re: drawLine( ) fails?

new topic     » goto parent     » topic index » view thread      » older message » newer message
CoJaBo said...

The example code in the last post is incorrect ...

Well ... "incorrect" might be a bit harsh. It is certainly not the normal way to do things but there is nothing inherently wrong with drawing on the screen during the Activate event - if that's what the application designer really wants to do. However 'activate' only happens once (usually) per control and any drawing done then may get wiped out whenever the window gets covered by another window or is made smaller by the user. But hey, if the designer knows about that and it doesn't matter to them, then sure ... use the activate event to draw the stuff.

But if you need the drawing to always be visible, no matter if the window changed size or gets covered by another, then the Paint event is a better one for you to use. In fact, with the paint event you get the exact coordinates of the area that needs to be redrawn, so one can determine the minimum amount of work to be done.

If the drawing on the window is a sort-of static background, it would actually be better to draw it on a Pixmap once and then during the paint event, just copy the corresponding subsection from the Pixmap to the window - a very fast operation.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu