I'm faced with a problem where I need to display some characters in a tree-view item (belonging to the Symbol charset) using "Symbol" font while
others in the default System font (Segoi UI on my Windows 7).
Custom draw allows us to draw different items using different fonts but I wish to draw the same item string using different fonts as it applies to each character
in the item string as told above.
So, what I've done with not-so-pleasing results w.r.t. drawing performance upon a horizontal scroll when the number of items is more so far is this.
I'm usingCDDS_ITEMPOSTPAINT for custom draw using different fonts for different characters in the same item string. So, essentially, upon receiving CDDS_ITEMPOSTPAINT , I"erase" what was drawn by Windows in the item rectangle and draw text using my own fonts.
However, I'm forced to sub-class the treeview winproc and write the horizontal scrolling (as well as hittesting for mouse) logic myself (setting scroll bar range, handling scroll bar notifications etc) since Windows does not have an idea as to how wide the item text is after I draw it using my own fonts (it may be wider or narrower than what Windows drew by default). Since, there's no message like WM_MEASUREITEM sent for treeview that would enable me to tell Windows the width of the item text I draw myself, I need to turn off the default Windows scrolling by specifying the style TVS_NOHSCROLL and put my own custom horizontal scrolling (by handling scroll bar notifications) and hittesting (since again, Windows won't have an idea in order to decide where the point falls whether on the lable, +/- button etc as to how much the item has been scrolled as it will be draw by me).
So, in a nutshell, my query is if there's a way for me to tell Windows the width of an item so it can set up the scroll bar correctly based on the width I draw and I'm saved from handling the scrolling logic myself (which is not so efficient and causes flicker as the number of items increases).
Thanks in advance,
--ANURAG.