简体   繁体   中英

How to set colour in child Clistbox with owner CMFCTabCtrl Class

I using 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM