I want to keep the ratio height/width of client area constant when resizing my window. Here's what I do now:

* Capture WM_SIZING
* Get the client area with an inverted AdjustWindowRect
* Recalculate new width or height with some div/mul
* Get new window RECT with another AdjustWindowRect call
* set the RECT sent by WM_SIZING to the new values

This code gets quite complex and long since I have to take into account which edge is being resized to set the new coordinates correctly (I can't adjust the right edge if user is pulling the upper-left corner), so I was wondering if there was some easy way with the API. I've done my best but I can't find anything for keeping the ratio of the client area constant. Any suggestions?

Posted on 2003-09-24 14:50:19 by Hugin
don't know if this will help, see the examples for more information
Posted on 2003-09-24 14:53:40 by Delight