15,978
社区成员
发帖
与我相关
我的任务
分享
DlgStatic* newstatic;
newstatic = new DlgStatic();
newstatic->Create("Name",WS_CHILD|WS_VISIBLE|SS_NOTIFY|SS_SUNKEN,CRect(2,2,50,50),this,IDC_STATIC);
newstatic->ShowWindow(SW_SHOW);
DlgStatic::DlgStatic()
{
m_clrFore = RGB(255,255,0);
m_clrBack = RGB(192,192,192);
m_brush.CreateSolidBrush(m_clrBack);
}
HBRUSH DlgStatic::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CStatic::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(pWnd->GetDlgCtrlID() == IDC_STATIC)
{
pDC->SetTextColor(m_clrFore);
pDC->SetBkColor(m_clrBack);
return (HBRUSH)m_brush.GetSafeHandle();
}
// TODO: Return a different brush if the default is not desired
return hbr;
}