AndrewMozley
Programmer
I have a form class which allows the controls within it to be re-sized at run time. In the Init() method of each of the control classes, the instance (for example a textbox) remembers its position, size and fontsize.
Then, when the form is re-sized, the form’s Resize() method visits each of the controls and recalculates the position &c.
This works fine; in the case of a Grid the column widths also need to be adjusted. So, in the same way, the grid’s Init() method remembers the width of each column. And the grid’s Resize() method then adjusts the columns.
In the case of a list box, which I sometimes use, the columns also need to be re-sized; however the Listbox does not seem to have a Resize() method, and the Column width properties are not stored separately. I realise that it is possible to parse the Columnwidths property, and then do the necessary arithmetic, but if anyone has been this way before I would be grateful for guidance.
Then, when the form is re-sized, the form’s Resize() method visits each of the controls and recalculates the position &c.
This works fine; in the case of a Grid the column widths also need to be adjusted. So, in the same way, the grid’s Init() method remembers the width of each column. And the grid’s Resize() method then adjusts the columns.
In the case of a list box, which I sometimes use, the columns also need to be re-sized; however the Listbox does not seem to have a Resize() method, and the Column width properties are not stored separately. I realise that it is possible to parse the Columnwidths property, and then do the necessary arithmetic, but if anyone has been this way before I would be grateful for guidance.