将下面代码放在OnPaint()函数中.
CWnd *pwnd=GetDlgItem(IDC_STATIC_COLOR);
CRect rect;
pwnd->GetClientRect(rect);
CDC *pdc=pwnd->GetDC();
CBrush *newbrush=new CBrush;
newbrush->CreateSolidBrush(RGB(255,0,0));
CBrush *oldbrush=pdc->SelectObject(newbrush);
pdc->Rectangle(rect);
pdc->SelectObject(oldbrush);
delete newbrush;
UpdateData(FALSE);
CWnd *pwnd=GetDlgItem(IDC_STATIC_COLOR);
CRect rect;
pwnd->GetClientRect(rect);
CDC *pdc=pwnd->GetDC();
CBrush *newbrush=new CBrush;
newbrush->CreateSolidBrush(RGB(255,0,0));
CBrush *oldbrush=pdc->SelectObject(newbrush);
pdc->Rectangle(rect);
pdc->SelectObject(oldbrush);
delete newbrush;
UpdateData(FALSE);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货