Tip for those of you who like to write custom controls: I had some
minor problems in my editor - sometimes scrolling slowed down and
became "jerky". No matter how I tried, I couldn't find a solution.
Control could work fine for hours and then suddenly this problem came up.
The editor uses a memDC which is refreshed in WM_SIZE, to keep all
things down to a minimum but still handle eventual resize, etc. Funny
thing was that when this problem occurred, simple resize and thereby
refresh of DC made everything ok again. Led me to suspect some sort of
memory fragmentation, whatever, occurred in the control's DC after a while.
Looked around at MSDN and found interesting page about Window Classes at http://msdn.microsoft.com/library/te...n_classy32.htm
So, started experimenting with the Window class I use for it and found
that using CS_CLASSDC instead of CS_PARENTDC in WNDCLASS style solved
the problem, plus actually made repaint/scrolling a tiny little bit faster.
Control has been in use for +5 hours now, no problem at all. May not
apply to all types of controls, but can be worth experimenting with..
------------------
minor problems in my editor - sometimes scrolling slowed down and
became "jerky". No matter how I tried, I couldn't find a solution.
Control could work fine for hours and then suddenly this problem came up.
The editor uses a memDC which is refreshed in WM_SIZE, to keep all
things down to a minimum but still handle eventual resize, etc. Funny
thing was that when this problem occurred, simple resize and thereby
refresh of DC made everything ok again. Led me to suspect some sort of
memory fragmentation, whatever, occurred in the control's DC after a while.
Looked around at MSDN and found interesting page about Window Classes at http://msdn.microsoft.com/library/te...n_classy32.htm
So, started experimenting with the Window class I use for it and found
that using CS_CLASSDC instead of CS_PARENTDC in WNDCLASS style solved
the problem, plus actually made repaint/scrolling a tiny little bit faster.
Control has been in use for +5 hours now, no problem at all. May not
apply to all types of controls, but can be worth experimenting with..

------------------
Comment