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.
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.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
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.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
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.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill