I have ben using the resizeHelper to resiz\e the dialog, but for the Window to look right I need to Minimize then Restore it to clear down some odd bitmaps still on display.
I did try and add calls to ShowWindow(SC_MINIMIZE); and
ShowWindow(SC_RESTORE);
See below but no luck
void CIDU_EmuDlg::OnSize(UINT nType, int cx, int cy)
{
/* Arange for the display to be resized */
CDialog::OnSize(nType, cx, cy);
m_resizeHelper.OnSize();
ShowWindow(SC_MINIMIZE);
ShowWindow(SC_RESTORE);
OnPaint();
}
I have to use the mouse to Min and Restore, any suggestions?
I am still confused as to why you want to do this, but have you tried SysCommand(SC_MINIMIZE)/ SC_RESTORE ?
Also, is the dialog the only thing in the application, or is it a child window ? (If you have a CFrameWnd Class, you may need to get that to send the command to the dialog)
The application is a single dialog with buttons, checkboxes, picture control, animation control. All these controls are placed on top of a bitmap which is covering the whole dialog. Note some of the buttons have Bitmaps on them too.
When I resize the dialog the original dialog bitmap is still on display. So what I need to do (must be a better way) is Minimize the application and then Restore it.
Then the dialog is displayed OK.
Now the dialog has Min, Max and Close on the title bar.
I was thinking of using the line below in the OnSize() function
SendMessage(SC_MINIMIZE,0,0);
That should IIRC send the minimize message to the current window. But I haven't been at a workstation with .Net on all day, so I can't test it, or read MSDN to be sure.
Good Luck ! (But I think that OnSize() is only sent after you have let go of the mouse button, so is this the right event to be using for your application ?)
You can always check the size of the rectangle (OnSize() has the cx and cy parameters passed to it doesn't it, and if either exceeds a certain value, just set it to the threshold ?
I did try this:
void CIDU_EmuDlg::OnSize(UINT nType, int cx, int cy)
{
if((cx < rectMax.Width()) & (cy < rectMax.Height()))
{
/* Arange for the display to be resized */
CDialog::OnSize(nType, cx, cy);
m_resizeHelper.OnSize();
}
::InvalidateRect(m_hWnd, 0, 1);
OnPaint();
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.