![](/img/trans.png)
[英]How to change label fonts when resizing using tablelayoutpanel in C#
[英]How to change the order of columns TableLayoutPanel c#
我有一個帶有 x 列的行的TableLayoutPanel
控件。 里面的每個單元格都有一個面板控件。
我想在運行時將 x 列與 y 列交換。
我怎樣才能做到這一點?
再一次,問題是:如何在tablelayoutPanel
更改列的順序?
如果您有對每個 Panel 控件的引用,請使用它們並跳過下面代碼的前兩行(即我在下面使用的 GetControlFromPosition() 函數來獲取對控件的引用)-
Control ctr1 = tableLayoutPanel1.GetControlFromPosition(0, 0);
Control ctr2 = tableLayoutPanel1.GetControlFromPosition(1, 1);
tableLayoutPanel1.SetCellPosition(ctr1, new TableLayoutPanelCellPosition(1, 1));
tableLayoutPanel1.SetCellPosition(ctr2, new TableLayoutPanelCellPosition(0, 0));
用要放置控件的行和列索引替換 0 和 1。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.