开发者

Win32 UI - Making a control expand as the parent expands

开发者 https://www.devze.com 2023-02-13 13:11 出处:网络
I\'m using a resource editor to design my UI (resedit), however I cant find an option to tell it to keep the width of a control (listview) the same as its parent control (dialog) - so that when I resi

I'm using a resource editor to design my UI (resedit), however I cant find an option to tell it to keep the width of a control (listview) the same as its parent control (dialog) - so that when I resize the dialog also the listview resizes.

Can I do this through the resource file or do I need to call some开发者_StackOverflow中文版 C/C++ function?


This is not automatic, you need to write some code to do it. Respond to the WM_SIZE message for the parent, determine how much the size changed, and resize the child by the same amount.

Functions that can resize a window are MoveWindow, SetWindowPos, and DeferWindowPos. DeferWindowPos is a lot more complicated but will result in a nicer update if there are many windows moving or changing size at the same time.

0

精彩评论

暂无评论...
验证码 换一张
取 消