Re: drawLine( ) fails?

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

Well ... "incorrect" might be a bit harsh.

Sorry if it came off ass offensive, but it is wrong and should not be recommended under any circumstances. Theres enough faulty Windows applications as it is, we don't any need more. :P

The Activate event occurs after a Window is opened. The window may not be visible at this point. Additionally, drawing in OnActivate implies duplicating code, since it must be done in OnRepaint as well. This also means that a window would be drawn twice when first opened. So yes, it is incorrect to draw during the OnActivate event, as it makes no sense to draw a control that is not visible, duplicate code, or do the same drawing operation twice in a row.

As said, Pixmaps, of course, give more flexibility, as the only operation needed during repaint is to blit the pixmap to the window. Drawing to the pixmap could be done anywhere, tho things are usually cleaner if all graphics code is kept together. Especially if the drawing is complex (taking many API calls to produce), this is indeed a better way as it will eliminate flicker (it comes at the cost of a slight increase in memory usage, but this has long since been made irrelevant).

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

Search



Quick Links

User menu

Not signed in.

Misc Menu