المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How can I force the redraw of buttons which overlay a picture bitmap in a Dialog



C++ Programming
09-16-2009, 04:40 AM
Using MFC Dialog App with VC6

I need some help to force redraw of buttons?

I have a bitmap image displayed in my dialog using the picture control and have positioned over the top of it number of CButton's (ie the buttons overlap the image). I want to get the buttons to remain displayed when I change the bitmap image in the button selected function.

If I have an "OnSel" function for each button with code like this :

void CDesignEditDlg::OnButtonSel3()
{
// TODO: Add your control notification handler code here
MessageBox("Button 3 Pressed", "Select", MB_OK) ;

}

When I run the app and press a button it is all fine, ie I get the button pressed message pops up and all the buttons are still shown.

Since I want to change the image displayed while the button is pressed I tried to modify my code to something like this.

void CDesignEditDlg::OnButtonSel2()
{
// TODO: Add your control notification handler code here
// Set new image
m_ctrlPageImage.SetBitmap(cBmp[1]);

MessageBox("Button 2 Pressed", "Select", MB_OK) ;

// Put old image back
m_ctrlPageImage.SetBitmap(cBmp[0]);
}


This works in that it changes the displayed image while the popup message is on screen but all the buttons other than the one I pressed have disappeared.

Is there a way to force MFC to redraw my buttons over the top of the image after I have changed it ??