Click here to Skip to main content
15,908,455 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Ownerdraw Listbox Pin
Nishad S3-Oct-07 2:14
Nishad S3-Oct-07 2:14 
GeneralRe: Ownerdraw Listbox Pin
Hamid_RT3-Oct-07 2:26
Hamid_RT3-Oct-07 2:26 
GeneralRe: Ownerdraw Listbox Pin
Nishad S3-Oct-07 2:35
Nishad S3-Oct-07 2:35 
GeneralRe: Ownerdraw Listbox Pin
Hamed Musavi3-Oct-07 2:45
Hamed Musavi3-Oct-07 2:45 
GeneralRe: Ownerdraw Listbox Pin
David Crow3-Oct-07 3:29
David Crow3-Oct-07 3:29 
AnswerRe: Ownerdraw Listbox Pin
Iain Clarke, Warrior Programmer3-Oct-07 4:45
Iain Clarke, Warrior Programmer3-Oct-07 4:45 
QuestionSet background color to List control Pin
Max++3-Oct-07 0:40
Max++3-Oct-07 0:40 
AnswerRe: Set background color to List control [modified] Pin
Hamed Musavi3-Oct-07 0:53
Hamed Musavi3-Oct-07 0:53 
I think you should override DrawItem which will be called when each item of the control is to be drawn. Then use the input parameter for that function(lpDrawItemStruct) like this:
CDC dc;
dc.Attach(lpDrawItemStruct->hDC);

dc.FillSolidRect(&lpDrawItemStruct->rcItem, RGB(100,200,0));

dc.Detach();


You should also manually draw text of each item, check to see if it is selected to highlight it and draw a border for active item.


By the way if your list control is inside a dialog, take a look at OnCtlColor of the dialog. It makes life times easier if you just need to change background or text color of a dialog control.

-- modified at 6:59 Wednesday 3rd October, 2007

// "Life is very short and is very fragile also." Yanni
while (I'm_alive)
{
cout<<"I love programming.";
}

AnswerRe: Set background color to List control Pin
Nishad S3-Oct-07 1:14
Nishad S3-Oct-07 1:14 
AnswerRe: Set background color to List control Pin
Hamid_RT3-Oct-07 2:06
Hamid_RT3-Oct-07 2:06 
GeneralRe: Set background color to List control Pin
Nishad S3-Oct-07 2:17
Nishad S3-Oct-07 2:17 
GeneralRe: Set background color to List control Pin
Hamid_RT3-Oct-07 2:26
Hamid_RT3-Oct-07 2:26 
QuestionSpace bar problem in scanf Pin
syarif203-Oct-07 0:11
syarif203-Oct-07 0:11 
QuestionRe: Space bar problem in scanf Pin
vikrant kpr3-Oct-07 0:26
vikrant kpr3-Oct-07 0:26 
AnswerRe: Space bar problem in scanf Pin
David Crow3-Oct-07 2:44
David Crow3-Oct-07 2:44 
AnswerRe: Space bar problem in scanf Pin
Anurag Gandhi3-Oct-07 4:28
professionalAnurag Gandhi3-Oct-07 4:28 
Questioninternal working of "sizeof()" operator Pin
Sachinpatole2-Oct-07 23:47
Sachinpatole2-Oct-07 23:47 
AnswerRe: internal working of "sizeof()" operator Pin
Rajesh R Subramanian2-Oct-07 23:50
professionalRajesh R Subramanian2-Oct-07 23:50 
GeneralRe: internal working of "sizeof()" operator Pin
Sachinpatole3-Oct-07 0:02
Sachinpatole3-Oct-07 0:02 
GeneralRe: internal working of "sizeof()" operator Pin
Nishad S3-Oct-07 1:22
Nishad S3-Oct-07 1:22 
JokeRe: internal working of "sizeof()" operator Pin
Hamid_RT3-Oct-07 2:09
Hamid_RT3-Oct-07 2:09 
AnswerRe: internal working of "sizeof()" operator Pin
DQNOK3-Oct-07 3:29
professionalDQNOK3-Oct-07 3:29 
Questionexception handling Pin
Daniel Kanev2-Oct-07 23:47
Daniel Kanev2-Oct-07 23:47 
AnswerRe: exception handling Pin
Waldermort2-Oct-07 23:51
Waldermort2-Oct-07 23:51 
GeneralRe: exception handling Pin
Sachinpatole3-Oct-07 0:06
Sachinpatole3-Oct-07 0:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.