tags:

views:

75

answers:

3

I want my window to always maintain a certain ratio of let's say 1.33333333. So, if the window is width = 800, height = 600 and the user changes the width to 600, I want to change the height to 450 automatically.

I'm already intercepting WM_SIZE but I don't know if it's enough; also I don't know how to change the width or height to maintain my ratio.

+3  A: 

See WM_SIZING: http://msdn.microsoft.com/en-us/library/ms632647.aspx

Processing this message allows you to change resulting window size.

Janusz Lenar
A: 

Try the Resize event. There is an example of how to maintain a desired aspect ration in the link.

mjmarsh
I'm not using .NET, and that's .NET I believe :/
woor
+6  A: 

WM_SIZING is sent to the window while the user is resizing the window.

Rather handle WM_WINDOWPOSCHANGING - this is sent by the internal SetWindowPos function when code (or the user) changes the window size and will ensure that even tile & cascade operations obey your sizing policy.

Chris Becke
Works perfectly; thanks!
woor