How to force the control to redraw?
-
Hi everyone: I wrote a MFC dialog-based program. My program need to use the GDI function FillRect to fill teh dialog in some specified color. But there are two buttons in that dialog, my problem is how to force them to be redrawn after I filled the dialog? Since the action of the function FillRect would fill whole dialog with my color and these 2 buttons would also be covered. Can somebody tell me how to do? I have no much time on this project. Thanks!
-
Hi everyone: I wrote a MFC dialog-based program. My program need to use the GDI function FillRect to fill teh dialog in some specified color. But there are two buttons in that dialog, my problem is how to force them to be redrawn after I filled the dialog? Since the action of the function FillRect would fill whole dialog with my color and these 2 buttons would also be covered. Can somebody tell me how to do? I have no much time on this project. Thanks!
-
Hi everyone: I wrote a MFC dialog-based program. My program need to use the GDI function FillRect to fill teh dialog in some specified color. But there are two buttons in that dialog, my problem is how to force them to be redrawn after I filled the dialog? Since the action of the function FillRect would fill whole dialog with my color and these 2 buttons would also be covered. Can somebody tell me how to do? I have no much time on this project. Thanks!
Well if that is all it needs to do then just override OnEraseBkgnd() to fill the background.
// IN HEADER
class CMyDialog : public CDialog
{
//.......
int m_FillBrushIndex;
CBrush m_FillBrush[2];
//.......
};// IN CPP FILE
afx_msg BOOL CMyDialogLLOnEraseBkgnd( CDC* pDC )
{
//...
pDC->FillRect(&rect,&m_FillBrush[m_FillBrushIndex]);
//...
return TRUE;
}void CLineInfoDlg::OnButton1()
{
//...
m_FillBrushIndex = 0;
InvalidateWindow();
}void CLineInfoDlg::OnButton2()
{
//...
m_FillBrushIndex = 1;
InvalidateWindow();
}INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen