title: Winforms - Fill user control inside panel
body: <p>I am new to winforms, what i am trying to do is a simple form:</p>
  
  <ul>
  <li><p>In my form there is a panel.</p></li>
  <li><p>The panel is linked to a user control</p></li>
  <li><p>The user control should fill the panel. </p></li>
  </ul>
  
  <p>This is my form:</p>
  
  <pre><code>public Form1()
      {
          InitializeComponent();
  
          UserControl1 userControl = new UserControl1();
  
          panel1.Controls.Add(userControl);
          userControl.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom)
       | AnchorStyles.Left) | AnchorStyles.Right)));
          userControl.Dock = DockStyle.Fill;
      }
  </code></pre>
  
  <p>Not working -> the control doest stretch</p>
  
  <p><img src="https://i.stack.imgur.com/JNfdL.png" alt="pic"></p>