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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh Window

Status
Not open for further replies.

sweep123

Technical User
May 1, 2003
185
GB
After doing some resizing on my dialog I have to Minimise it onto the task bar then restore to see it as it should be.

How would this be done in code?

Regards,
 
Have you tried catching the Message that the window has been resized, and then re-drawing the window ?
 
I did place a Paint call on the OnSize routine, but seem to need to clear down (erase)the Window first!
 
But as your dialog has been resized, this would be quite logical ?

Whats the issue here? U just want to send a WM minimise message, then a WM Restore (If so I think it's a WM_COMMAND)
 
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)

K
 
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.

Does that help explain the problem.
 
Sorry dont understand what you mean!

Do you mean capturing the system messages via ON_WM_SYSCOMMAND, if so, cant see/find where to put the code/events.

Am I missing something?

I was looking for some code to do the Min/Restore after the dialog has been resized.

Or are they an anternative way to do the Min/Restore to produce the same effect.
 
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 ?)
 
I ended up using

::InvalidateRect(m_hWnd, 0, 1);

in the OnSize routine and that worked OK.
 
I did try the SendMessage(SC_MINIMIZE,0,0); followed by SendMessage(SC_RESTORE,0,0);

But nothing happened.

I have a problem when the dialog is resize too large and was trying to find a way to stop the dialog being resized above a certain size.
 
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();
}


But no joy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top