Link to home
Start Free TrialLog in
Avatar of kdullea3
kdullea3

asked on

CCheckListBox Sizing problem

I've created a CCheckListBox through subclassing, but I set the default font to 12 point size for the dialog that the original listbox resides in.  The listbox is ownerdrawfixed and hasstrings.

When I populate the CCheckListBox everything seems to work until all the strings have been loaded and then I get an error in debug mode and it appears to have something to do with the minimum size of the items.

I can see the dialog on screen and all the strings are visible but the size of the checkbox is small (not the size I would expect for the 12 point font).

Since I have changed the default font size for this dialog do I need to implement an override of the measureitem method?  Just as a side note, if I set the dialog default font back to 8 point (the original setting) everything works fine.
Avatar of mblat
mblat

I think you do have to handle WM_MEASUREITEM

here is small article on the subject

http://codeguru.earthweb.com/listview/change_row_height.shtml

Hope it helps..

Avatar of kdullea3

ASKER

mblat - I looked at the article you recommended.  And although it was for CListView I tried to implement the concepts.

I derived my own CMyCheckListBox class, and was able to get as far as creating the control and getting it to use the MeasureItem override.  BUT... The drawitem was not valid, the strings were not drawn in proper relation to the rect they should have been in, they were drawn too low and overwritten by subsequent lines in the box.

Also, the check box could not be clicked, it simply wouldn't respond and the check box that was draw was still very small, it didn't seem to recognize the value supplied from measureitem at all.  Thanks for the recommendation but it seems I need to locate some sample code that is specific to this problem.
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the honest assessment