I am creating a custom Label control (just inheriting the standard Label control and redrawing the background and text) because I need a special background and frame. In the control's constructor, I set the AutoSize property to false, so for the new label, I can have a default default size.
Public Sub New() 'Set the default size of the control to 75x24 Me.Height = 24 Me.Width = 75 'Turn off the autosize property. Me.AutoSize = False 'Turn on double-buffering. Me.DoubleBuffered = True End Sub
In my application using this control, if I create a new custom shortcut at runtime (in code), the AutoSize property remains False and works correctly.
If I try to add a new custom label to my form at design time, it includes the AutoSize property set to True, and I need to manually set it to False in the properties window. This is not a huge problem, but I do not understand why the behavior is different.
Any ideas what causes this difference in behavior?
Stewbob
source share