title: User Resizing of Row and Columns in TableLayoutPanel At Runtime
body: <p>I'm working on a WinForm project and "trying" to create a TableLayoutPanel that the user can resize at runtime like the behavior of the SplitContainer. I've found some code that partially does this but it's incomplete. Can someone please help me out here?</p>
  
  <p>Thanks in advance,
  -DA </p>
  
  <p>This is the code I have so far that comes from a thread I found on CodeProject. The only thing different that I've done in my own is create a customTableLayoutPanel that inherits from TableLayoutPanel.</p>
  
  <pre><code>public partial class Form1 : Form
  {
      bool resizing = false;
      TableLayoutRowStyleCollection rowStyles;
      TableLayoutColumnStyleCollection columnStyles;
  
      public Form1()
      {
          InitializeComponent();
      }
  
      private void Form1_Load(object sender, EventArgs e)
      {
          rowStyles = tableLayoutPanel1.RowStyles;
          columnStyles = tableLayoutPanel1.ColumnStyles;
      }
  
      private void tableLayoutPanel1_MouseDown(object sender, MouseEventArgs e)
      {
          if (e.Button == System.Windows.Forms.MouseButtons.Left)
          {
              resizing = true;
          }
      }
  
      private void tableLayoutPanel1_MouseMove(object sender, MouseEventArgs e)
      {
          if (resizing)
          {
              columnStyles[0].SizeType = SizeType.Absolute;
              rowStyles[0].SizeType = SizeType.Absolute;
              rowStyles[0].Height = e.Y;
              columnStyles[0].Width = e.X;
          }
      }
  
      private void tableLayoutPanel1_MouseUp(object sender, MouseEventArgs e)
      {
          if (e.Button == System.Windows.Forms.MouseButtons.Left)
          {
              resizing = false;
          }
      }
  }
  </code></pre>