I am creating a custom Label control (by simply Inheriting the standard Label control and re-painting the background and text) because I need a very specific background and border. In the constructor of the control, I set the AutoSize property to false so I can have a standard default size for the new label.
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 that uses this control, if I create the new custom label at run time (in code), the AutoSize property stays False, and it works properly.
If I try to add the new custom label to my form at design time, it comes in with the AutoSize property set to True, and I have to manually set it to False in the properties window. It's not a huge problem, but I don't understand why the behavior is different.
Any ideas what is causing this difference in behavior?