// TODO: Change any attributes of the DC here if(pWnd->GetDlgCtrlID()==IDC_STATIC1) { CRect rc; pWnd->GetClientRect(&rc); pDC->FillSolidRect(rc.left,rc.top,rc.Width(),rc.Height(),RGB(255,0,0));
} // TODO: Return a different brush if the default is not desired return hbr; }
HBRUSH CDfgdfgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(pWnd->GetDlgCtrlID()==IDC_STATIC1)
{
CRect rc;
pWnd->GetClientRect(&rc);
pDC->FillSolidRect(rc.left,rc.top,rc.Width(),rc.Height(),RGB(255,0,0));
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
if(pWnd->GetDlgCtrlID()==IDC_PICTURE)
我注意到用其他的控件,系统回自动给他们一个编号,比如有两个BTN,会叫做IDC_BUTTON1,IDC_BUTTON2。但用PIC却可以两个都叫IDC_STATIC而不冲突。为什么会这样呢?
kingcom_xu() 老兄:
你用的就是叫IDC_STATIC吗?