对话框中有CSTATIC控件上填充颜色,但为何显不出来呢。
void CObitData::Surface()
{
CRect rect, CaptionRect;
GetClientRect(&CaptionRect);
GetDlgItem(IDC_STATICTN)->GetWindowRect(&rect);
this->ScreenToClient(&rect);
CaptionRect.right = rect.left - 5;
CaptionRect.left = 0;
// 绘制标题栏
CClientDC dc(this);
dc.FillSolidRect(&CaptionRect, RGB(20, 5, 186)); // 可以显示的
rect.left += 2;
rect.top += 2;
rect.right -= 2;
rect.bottom -= 2;
CString str;
str.Format("%d %d ", rect.top, rect.left);
//AfxMessageBox(str); 要这句下面填充的才会显示
dc.FillSolidRect(&rect, RGB(245, 15, 16)); // 没有上句//AfxMessageBox显示不出来。
}
AfxMessageBox(str); 有这句就可以, 好像是没有刷新的原由,
应该怎么做啊?这个函数放在了ONPAINT里面