Devraj
Devraj

Reputation: 1

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

Upvotes: 0

Views: 1404

Answers (3)

DevRaj
DevRaj

Reputation: 1

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

Upvotes: 0

djeidot
djeidot

Reputation: 4642

I think you need to override CListBox::DrawItem. There's an example in this MSDN page.

Upvotes: 1

Sanja Melnichuk
Sanja Melnichuk

Reputation: 3505

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

Upvotes: 0

Related Questions