Resizable table layout panel in c#

前端 未结 2 989
囚心锁ツ
囚心锁ツ 2021-01-12 11:05

I find the table layout panel in c# (.net 2.0) to be very primitive. I wanted to allow my users to resize the columns in a table layout panel but there are no ready made opt

2条回答
  •  礼貌的吻别
    2021-01-12 11:44

    Building on top of @Fredrik Mörk's solution:

    After embedding another SplitContainer(s), the only drawback is that they don't automatically resize together, so you quickly lose the tabular view. A solution could be to set up a SplitterMoved event handler for every applicable SplitContainer:

    private void mySplitContainer_SplitterMoved(object sender, SplitterEventArgs e) {
      mOtherySplitContainer.SplitterDistance = e.SplitX;
    }
    

    If your SplitContainer is horizontal use e.SplitX, if it's vertical use e.SplitY.

提交回复
热议问题