
"Reece Dunn" <msclrhd@hotmail.com> wrote in message news:BAY24-F25jJ8uT6Ssuo000635b5@hotmail.com...
Matt S Trentini wrote:
John Torjo wrote:
Any object that allocates a handle under Windows (pens, brushes, dc's, etc) consume those resources and if you've got a graphically intense GUI using a greedy GUI library (ie one that holds it's handles for a long duration) that limit isn't too hard to break.
Wouldn't you process the pen objects, etc. when handling the drawing event. Instead of storing a pen handle for each line (which IMHO is overkill), you would do something like:
I'd hope to keep the idea of acquiring and releasing system resources at a lower level. It then becomes the ( abstracted) output-devices job to acquire and release resources efficiently. For instance when drawing a 'stream' of lines, the stream might note a change in line colour, width,or style and only then see the need to change the 'pen', possibly with a cache, where resources that havent been used for a while are released. A similar approach might be applicable to GUI objects in general. Keep them as dumb as possible, until they are 'activated', and then dumb them down again if they dont appear to be being used. regards Andy Little