|
-
April 1st, 1999, 08:23 AM
#1
Re: How can I can the text and background color of CEdit control ?
Hi,
the colors of controls in a dialog is controlled by the WM_CTLCOLOR message send to the control. There you can change
the colors of each control. You must return a brush handle. Here some sample if you use MFC:
//this member you create using class wizard
HBRUSH CPassWordDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
// default returns brush, but you can use your own
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if ( pWnd->GetDlgCtrlID( ) == YourControl_ID )
{
pDC->SetTextColor(COLOR_TEXT);
pDC->SetBkColor(COLOR_BACKGND);
hbr = m_Brush; // your own brush for the background of your control
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
Hope this helps
R.Seibert
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
|