Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh of the mainfrm

Status
Not open for further replies.

StefanoCarniel

Programmer
Apr 29, 2005
15
0
0
IT
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?
 
Ok, I solved the problem using InvalidateRect in the OnUpdate.

Thank you to all for your answers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top