ListBox Trouble

olsonpm

Well-known member
Joined
Aug 24, 2010
Messages
46
Programming Experience
Beginner
So I finally am done fixing my ListBox control to run smoothly, but it took a long time to do that. My question is whether or not there's an easier way to accomplish this. From all the google searching I've done the past couple days, it seems there is none. Here's my train of work.

I started with a list box to display lines of text as data. I then decided that alternating background colors for each item would be nice, so I had to switch to an 'owner draw fixed'. After that, I was getting an annoying flicker of the text when resizing or gaining focus, so I had to make a 'DoubleBufferedListBox' class, and overwrite the onPaint method. This caused problems with horizontal scrolling, and still had a flicker with the item that had focus. To fix this problem, I override the WndProc fxn and intercept the WM_HSCROLL, WM_SIZE, and WM_SETFOCUS messages. Only then, did I finally have the listbox with no UI glitches. All for some alternating background colors...

I mean, learning about winApi for the first time was great, but is there an easier way to go about this?
 
Back
Top