
Background & Text color CEdit
Quote:
>How can I change the backcolor and the textcolor of a CEdit if I know the
>resource ID (e.g. IDC_EDIT1)??
Willem,
Handle OnCtlColor:
HBRUSH CBitDlgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
if ( ( nCtlColor == CTLCOLOR_EDIT ) &&
( pWnd->GetWindowsLong(GWL_ID) == IDC_EDIT1 ) )
{
LOGBRUSH LogBrush;
LogBrush.lbStyle = BS_SOLID;
LogBrush.lbColor = RGB( 127, 127, 127);
SetTextColor( pDC->m_hDC, RGB( 255, 255, 255 ) );
SetBkColor( pDC->m_hDC, RGB( 127, 127, 127) );
hbr = CreateBrushIndirect( &LogBrush );
}
return hbr;
Quote:
}
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.