If I understand correctly, You want to move the border between two columns. So from that border's point of view, you have a left and a right column.
I'd try something like this:
private System.Windows.Forms.TableLayoutPanelColumnStyle _leftColumnStyle = null;
private System.Windows.Forms.TableLayoutPanelColumnStyle _rightColumnStyle = null;
private System.Drawing.Point _locationWhereUserStartedDragging = new Point(-1, -1);
tableLayoutPanel1_MouseDown(object sender, MouseEventArgs e)
{
_locationWhereUserStartedDragging = e.Location;
GetColumnsThatUserClickedInBetween(e, ref _leftColumnStyle, ref _rightColumnStyle);
foreach(ColumnStyle style in tableLayoutPanel1.ColumnStyles)
{
if( style.Equals(_rightColumnStyle))
{
style.SizeType = SizeTypes.AutoSize;
}
else
{
style.SizeType = SizeTypes.Absolute;
}
}
}
tableLayoutPanel1_MouseMove(object sender, MouseEventArgs e)
{
_leftColumnStyle.Width = e.Location.X - _locationWhereUserStartedDragging.X;
}
When the user presses the mouse button down, our application remembers where that was to calculate how far the user may have moved the mouse.
It also remembers the single column that is set to have an automatically calculated width. So when we change the left column's width, the right one should follow.