Label not sizing correctly

  • Thread starter Thread starter Care Lotz
  • Start date Start date
C

Care Lotz

Hi All

We are in the process of porting our existing VB 6 app
containing our own composite user controls over to .NET.
A control typically consists out of a label (used for the
caption), another control for input (i.e. textbox/combo)
and also an error provider to use for displaying errors.

These controls are added dynamically to a form at run-
time, i.e. we have build intelligent engines that are
responsible for dynamically laying out the screens through
metadata specified within a DB. Our problem is with the
captions of the composite controls. We set the AutoSize
on the label to True to ensure that the caption sizes
correctly when the label is assigned to the control at run-
time. However, the caption does not seem to size
correctly as it leaves some extra blank space in front of
the caption which then draws over a the frame boundary in
which the control is situated. Why is this happening? We
did not have the same sizing problem in VB 6. We've tried
setting the Autosize to False and then use the
Graphics.MeasureString function to determine the width
ourselves, but the function returns the same size as when
AutoSize is set to True.

What can we do to fix the problem? Has this got to do
with the font we are using? We are using the Ambient font
which maps to MS SansSerif 8.25"

Any suggestions?

Carel
 
Back
Top