MFC Question: Download MFC PDF

How to give color for dialog button or static buuto?

Tweet Share WhatsApp

Answer:

Brush *brush;
Initialize the brush pointer in the constructor of your Dialog
Code:
brush = new CBrush(RGB(49,49,49));
Add the WM_CTLCOLR Message handler for the dialog and add the following code
Code:
switch (nCtlColor) {

case CTLCOLOR_BTN:
pDC->SetTextColor(RGB(0, 255, 0));
pDC->SetBkColor(RGB(0, 0, 0));
return (HBRUSH)(brush->GetSafeHandle());
default:
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}

Download MFC PDF Read All 26 MFC Questions
Previous QuestionNext Question
List out the basic features of MFC?Which Macro is a Super set of other two macro DECLARE_SERIAL, DECLARE_DYNAMIC and DECLARE_DYNCREATE?