How to force a window to maintain a certain width/height ratio when resized

Posted by woor on Stack Overflow See other posts from Stack Overflow or by woor
Published on 2010-03-15T16:31:01Z Indexed on 2010/03/15 16:49 UTC
Read the original article Hit count: 181

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about c++

Related posts about winapi