I have a user control (that displays some basic information about some events) called AE. I have another user control called CTCAE containing a panel that I wish to populate with the AEs. Within each AE is a tablelayoutpanel control, and within each cell of this is a label.
The labels are populated from a database, and using the e.Graphics.MeasureString of the AE paint event, I've managed to get the AE labels to resize according to the lengths of the labels. So far so good.
However, the problem I'm having is locating the AE control within the panel in CTCAE. If I simply add each AE to the panel, as expected they are all placed in the top left corner and overwrite one another. I've tried a couple of approaches to overcome this;
1. add a property to the AE control that gives the height of the highest label and use this when adding the controls to the panel
2. get the height of the AE control when adding to the CTCAE panel
Using these heights, I could increment the location of the next AE control.
However, the height of each control is not correctly recorded. The height is always given as 38, which is the original size of the control prior to being resized by the paint event. It seems that the paint event resizes the control for display, but I can't access its new size.
How can I get the each controls height so I can locate them correctly?
Thanks
The labels are populated from a database, and using the e.Graphics.MeasureString of the AE paint event, I've managed to get the AE labels to resize according to the lengths of the labels. So far so good.
However, the problem I'm having is locating the AE control within the panel in CTCAE. If I simply add each AE to the panel, as expected they are all placed in the top left corner and overwrite one another. I've tried a couple of approaches to overcome this;
1. add a property to the AE control that gives the height of the highest label and use this when adding the controls to the panel
2. get the height of the AE control when adding to the CTCAE panel
Using these heights, I could increment the location of the next AE control.
However, the height of each control is not correctly recorded. The height is always given as 38, which is the original size of the control prior to being resized by the paint event. It seems that the paint event resizes the control for display, but I can't access its new size.
How can I get the each controls height so I can locate them correctly?
Thanks