Hi,
I have a realizable window with a list view in it. When the window resizes, I'd like to resize it as well. Is there an automatic way to do this, or do I have to do it manually? Thanks.
Printable View
Hi,
I have a realizable window with a list view in it. When the window resizes, I'd like to resize it as well. Is there an automatic way to do this, or do I have to do it manually? Thanks.
I create the listview as a ratio of the window size (ie 90% height, 30% width)
I process WM_SIZE (OnSize) msgs and call SetWindowPos() with the new ratio.
Some owner draw can cause issues with this though, in which case I destroy the listview and create a new one.
I decide at design time how big the controls need to be to look good and fit the data. I adjust the controls ratio (percentage) accordingly and hard code it. I get the ratio by trial and error (looking at it).
The WM_SIZE contains the new width and height of the window.
I calc the controls new width and height using the ratio and the new size. Then use SetWindowPos() to change the size of the control.
I do not need the 'amount' of change, just the new width and height.
This also ensures that my app looks proportional at any resolution and window size.