• Advertisement
Sign in to follow this  

Resize window.. But while keeping the same ratio.

This topic is 4796 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. Simple question. Can you do something so that a win32 window will maintain it's proportions when you try to resize it, and if so, how? I wish I could elaborate more, but that's pretty much all I need to know. Thanks, ~Adams555~ (I have a 1024x768 window, and I need it to stay at that ratio. (the ratio is 1 : 1+1/3)

Share this post


Link to post
Share on other sites
Advertisement
case WM_SIZING:
{
RECT* rect = (RECT*)lparam;
int width = rect->right-rect->left;
int height = rect->bottom-rect->top;
if(width != height*3/4)
{
height = width - width/4;
rect->bottom = rect->top + height;
}
}
break;

Share this post


Link to post
Share on other sites
no

edit:
"The WM_SIZE message is sent to a window after its size has changed."

"The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position."

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement