HBRUSH CLogindlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
if( CTLCOLOR_STATIC == nCtlColor && pDC )
{
pDC->SetBkColor( SPLASH_BKCOLOR );
pDC->SetTextColor( SPLASH_TEXTCOLOR );
}
if( NULL == m_brushBK.GetSafeHandle() )
m_brushBK.CreateSolidBrush( SPLASH_BKCOLOR );
HBRUSH hbr = (HBRUSH)m_brushBK.GetSafeHandle();
return hbr;
}
这是我实现的功能
HBRUSH CLearn18Dlg::OnCtlColor(CDC *pDC,CWnd *pWnd,UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
if(nCtlColor == CTLCOLOR_STATIC)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkColor(RGB(255,255,255));
}
return hbr;
}
void CLearn18Dlg::OnLButtonDown(UINT nFlags,CPoint point)
{
CWnd *pWnd = GetDlgItem(IDC_MODIFY);
CRect rect;
pWnd->GetWindowRect(&rect);
ScreenToClient(&rect);
if(point.y > rect.top && point.y < rect.bottom && point.x > rect.left && point.x < rect.right){
CStatic *static1 = (CStatic *)GetDlgItem(IDC_MODIFY);
static1->SetWindowText("开始密码");
}
}