How to set colour in child Clistbox with owner CMFCTabCtrl Class
I u开发者_Python百科sing MFC AppWizard and created the SDI application I need to set colour for the outputwnd debug tab in some sequence for example if any wrong value entered in the some control i need to display text in RED stating that invalid value entered
if login done welcome message in GREEN and so on
I tried to use DrawItem I am not able to set the listBox stye as LBS_OWNERDRAWFIXED|LBS_HASSTRING on AddString i am getting error
How to set colour in child Clistbox with owner CMFCTabCtrl Class
I think you need to override CListBox::DrawItem
. There's an example in this MSDN page.
few years ago i use this advanced mvc listbox from Ultimate Toolbox http://www.codeproject.com/KB/MFC/UltimateToolbox_ListBoxEx.aspx
You can easy change items color, font etc with this
Thanks to all for quick and helpfull reply The help resolved my problem and I am able to change the colour and font of the list box One more thing i want to add We need to override measureItem as well. No need to add any code but need to have defination and declaration otherwise the application will throw execption for using LBS_OWNERDRAWFIXED|LBS_HASSTRING
精彩评论