【问题标题】:How to send dynamic Label to another column of TableLayoutPanel如何将动态标签发送到 TableLayoutPanel 的另一列
【发布时间】:2014-09-06 18:39:19
【问题描述】:

如何将动态标签值发送到窗体中 TableLayoutPanel 的另一列。我在 TableLayoutPanel 的左侧和右侧有两列。这是我的代码:

lblOpt4.Dock = DockStyle.Right;
tableLayoutPanel1.Controls.Add(lblOpt4);

通过使用 Dock 文本显示在右侧,但在 TableLayout 面板的左列中缺少整个文本流(缺少文本序列)

【问题讨论】:

  • 您的问题解决了吗?

标签: c# .net winforms tablelayoutpanel


【解决方案1】:

试试这个:

tableLayoutPanel1.Controls.Add(lblOpt4);  // adds to the TFP
lblOpt4.AutoSize = false;                 // allows for multiple lines, if needed
lblOpt4.Dock = DockStyle.Fill;            // fills the Cell, if needed
tableLayoutPanel1.SetColumn(lblOpt4, 1);  // sets the column

要进行微调,您可能需要使用Padding 和/或Margin..

如果需要,您可以使用 :

设置行
tableLayoutPanel1.SetRow(lblOpt4, row);   // sets the row

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多