Click here to Skip to main content
16,008,750 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Question about...ehh, i don't even know Pin
Jose Lamas Rios30-Jun-05 7:04
Jose Lamas Rios30-Jun-05 7:04 
GeneralRe: Question about...ehh, i don't even know Pin
toxcct30-Jun-05 7:19
toxcct30-Jun-05 7:19 
GeneralRe: Question about...ehh, i don't even know Pin
Jose Lamas Rios30-Jun-05 8:37
Jose Lamas Rios30-Jun-05 8:37 
GeneralRe: Question about...ehh, i don't even know Pin
toxcct30-Jun-05 20:27
toxcct30-Jun-05 20:27 
GeneralDifference on CSingleLock ::Lock and CSyncObject::Lock Pin
yccheok30-Jun-05 6:29
yccheok30-Jun-05 6:29 
GeneralCritical Section vs. Lock Pin
Peter Weyzen30-Jun-05 9:26
Peter Weyzen30-Jun-05 9:26 
GeneralRe: Difference on CSingleLock ::Lock and CSyncObject::Lock Pin
PJ Arends30-Jun-05 10:05
professionalPJ Arends30-Jun-05 10:05 
GeneralCList Box controls MFC Pin
goodoljosh30-Jun-05 5:44
goodoljosh30-Jun-05 5:44 
I am using .NET with and MFC application.

I have 2 List Boxes on my main dialog. I want to change the color of just one of them to a "pink" for error state. Here is what I have so far....., but it is changing the color of both list boxes to the color.

In the constructor of my main dialog...
m_pEditBkBrush = new CBrush(RGB(255, 200, 200));


HBRUSH CPPMLAnalyzerDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
/*HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

pDC->SetBkColor(RGB(10,100,100));

// TODO: Return a different brush if the default is not desired
return hbr;*/
switch (nCtlColor) {

case CTLCOLOR_LISTBOX:
pDC->SetBkColor(RGB(100, 100, 100));
return (HBRUSH)(m_pEditBkBrush->GetSafeHandle());


default:
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
/*pDC->SetBkColor(RGB(100, 100, 100));
return (HBRUSH)(m_pEditBkBrush->GetSafeHandle());*/
}

}

As you can see, I am trying to set the background color and then return the CBrush from before.

Not sure what I am doing wrong.

Thanks,

Josh
GeneralRe: CList Box controls MFC Pin
Jose Lamas Rios30-Jun-05 5:52
Jose Lamas Rios30-Jun-05 5:52 
GeneralRe: CList Box controls MFC Pin
David Crow30-Jun-05 5:57
David Crow30-Jun-05 5:57 
GeneralRe: CList Box controls MFC Pin
goodoljosh30-Jun-05 6:12
goodoljosh30-Jun-05 6:12 
GeneralRe: CList Box controls MFC Pin
David Crow30-Jun-05 6:19
David Crow30-Jun-05 6:19 
GeneralRe: CList Box controls MFC Pin
goodoljosh30-Jun-05 6:30
goodoljosh30-Jun-05 6:30 
GeneralRe: CList Box controls MFC Pin
goodoljosh30-Jun-05 6:35
goodoljosh30-Jun-05 6:35 
GeneralGmail Drive namespace extension Pin
Dreaser$30-Jun-05 4:58
Dreaser$30-Jun-05 4:58 
GeneralRe: Gmail Drive namespace extension Pin
Dreaser$1-Jul-05 0:14
Dreaser$1-Jul-05 0:14 
QuestionHow to position a toolbar??? Pin
IlanTal30-Jun-05 4:47
IlanTal30-Jun-05 4:47 
AnswerRe: How to position a toolbar??? Pin
Cedric Moonen30-Jun-05 4:54
Cedric Moonen30-Jun-05 4:54 
GeneralRe: How to position a toolbar??? Pin
IlanTal1-Jul-05 8:37
IlanTal1-Jul-05 8:37 
GeneralAccount type Pin
__makaveli__30-Jun-05 3:10
__makaveli__30-Jun-05 3:10 
GeneralRe: Account type Pin
Blake Miller30-Jun-05 4:45
Blake Miller30-Jun-05 4:45 
GeneralRe: Account type Pin
David Crow30-Jun-05 5:51
David Crow30-Jun-05 5:51 
GeneralRe: Account type Pin
__makaveli__30-Jun-05 5:52
__makaveli__30-Jun-05 5:52 
GeneralVersion Control vs. resource files ( resource.h ) Pin
Maximilien30-Jun-05 2:48
Maximilien30-Jun-05 2:48 
GeneralRe: Version Control vs. resource files ( resource.h ) Pin
krmed30-Jun-05 4:05
krmed30-Jun-05 4:05 

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.