|
-
April 17th, 1999, 12:58 PM
#1
Dialog CEdit Control Color
I have created a single dialog box with 3 controls. I created the following function and attatched it to WM_CTLCOLOR of the dialog box using the appwizard. However, the dialog is created and my custom colors are not even posted to the box. I can step through the code with debug and it is finding the controls, just not setting the right colors.
I'm new to MFC and this is driving me crazy. You would think there should be an easier way to change a dialog controls background and text color.
TIA
Andy
HBRUSH CSafeMsgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor == CTLCOLOR_EDIT)
{
int ID = pWnd->GetDlgCtrlID();
if(ID == IDC_EDIT1)
{
pDC->SetTextColor(RGB(23, 29, 230));
pDC->SetBkMode(TRANSPARENT);
hbr = (HBRUSH)(RGB(253, 253, 0));
}
if(ID == IDC_EDIT2)
{
pDC->SetTextColor(RGB(23, 29, 230));
pDC->SetBkMode(TRANSPARENT);
hbr = (HBRUSH)(RGB(253, 253, 0));
}
if(ID == IDC_STATIC)
{
pDC->SetTextColor(RGB(255,255,254));
pDC->SetBkMode(TRANSPARENT);
hbr = (HBRUSH)::GetStockObject(BLACK_BRUSH);
}
}
return hbr;
}
ô¿ô
«=»
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|