title: Setting default size/text of custom control in c#
body: <p>I am creating a custom control in my C# application in order to add a new property (MyProperty below). It is inheriting from Label. One thing I would like it to do, is display at a particular size when I drag it on to my form (200x132). I'd also like it to display no text. However, no matter how I try to do this, it doesn't seem to work. I am able to set BackColor and BorderStyle with no problem, however. I'm fairly new to C#, so maybe I'm missing something obvious.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>using System.Drawing;
  using System.Windows.Forms;
  
  namespace MyProgram
  {
  
      public enum MyEnum
      {
          Value1, Value2, Value3
      }
  
      public partial class MyControl : Label
      {
  
          public MyControl()
          {
              BackColor = Color.LightCoral;
              BorderStyle = BorderStyle.FixedSingle;
              AutoSize = false;
              Size = new Size(200, 132);
              Text = "";
              InitializeComponent();
          }
  
          protected override void OnPaint(PaintEventArgs pe)
          {
              base.OnPaint(pe);
          }
  
          private MyEnum myProperty;
  
          public MyEnum MyProperty
          {
              get { return myProperty; }
              set { myPropery = value; }
          }
      }
  }
  </code></pre>