AndrewMozley
Programmer
I have a form class which re-sizes its controls when the form is re-sized.
To that end each control (Text box, label, grid &c) has properties in which can be saved its original width height, fontsize &c. Each control remembers these interesting values in its own Init() method. When the form is re-sized, it visits each control, recalculates the width, height &c of that control in proportion to the revised form size.
This works fine. I would also like to do a similar thing with the columns of the grid, and this is where I having a difficulty.
It was easy enough to subclass the grid itself to have these properties of its original width and height. However I would rather like to have a property for each column to remember its original column width. But I do not know how to do that: in my sub-classed grid I do not know how many columns there are going to be, so I cannot easily add this extra property to each column. As a kluge I have taken to using the comment field of each column (at run time, when I know how many columns there are) to hold this value, but this does not seem quite respectable.
Suggestions welcomed. Andrew
To that end each control (Text box, label, grid &c) has properties in which can be saved its original width height, fontsize &c. Each control remembers these interesting values in its own Init() method. When the form is re-sized, it visits each control, recalculates the width, height &c of that control in proportion to the revised form size.
This works fine. I would also like to do a similar thing with the columns of the grid, and this is where I having a difficulty.
It was easy enough to subclass the grid itself to have these properties of its original width and height. However I would rather like to have a property for each column to remember its original column width. But I do not know how to do that: in my sub-classed grid I do not know how many columns there are going to be, so I cannot easily add this extra property to each column. As a kluge I have taken to using the comment field of each column (at run time, when I know how many columns there are) to hold this value, but this does not seem quite respectable.
Suggestions welcomed. Andrew