StefanoCarniel
Programmer
Hello, I created a SDI project with document/view paradigm, then I added a dialog box with two buttons to change the background color of the mainfrm. Here is the code:
void CNewFrame::OnOK()
{
BkColor = RGB (0,0,0);
CDialog::OnOK();
}
void CNewFrame::OnCancel()
{
BkColor = RGB (255,255,255);
CDialog::OnOK();
}
where NewFrame is the dialog box.
void CMyprogramView::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetClientRect (&rect);
dc.FillSolidRect (rect, BkColor);
}
It works fine, but to see the new color I have to minimize and then maximize my application. It seems I need to manually refresh the client area. Is there a way to change the color immediately when I click on the buttons of the dialog?
void CNewFrame::OnOK()
{
BkColor = RGB (0,0,0);
CDialog::OnOK();
}
void CNewFrame::OnCancel()
{
BkColor = RGB (255,255,255);
CDialog::OnOK();
}
where NewFrame is the dialog box.
void CMyprogramView::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetClientRect (&rect);
dc.FillSolidRect (rect, BkColor);
}
It works fine, but to see the new color I have to minimize and then maximize my application. It seems I need to manually refresh the client area. Is there a way to change the color immediately when I click on the buttons of the dialog?