tableLayoutPanel 列宽度设置

悠悠 2021-09-17 13:08 465阅读 0赞
  1. 1 public partial class UserControl1 : UserControl
  2. 2 {
  3. 3 public UserControl1()
  4. 4 {
  5. 5 InitializeComponent();
  6. 6 this.tableLayoutPanel1.ColumnStyles[1].Width = 0;
  7. 7 }
  8. 8 //显示
  9. 9 private void toolStripButton1_Click(object sender, EventArgs e)
  10. 10 {
  11. 11 this.tableLayoutPanel1.ColumnStyles[1].Width = this.tableLayoutPanel1.ColumnStyles[0].Width;
  12. 12 this.Refresh();
  13. 13 }
  14. 14 //隐藏
  15. 15 private void toolStripDropDownButton1_Click(object sender, EventArgs e)
  16. 16 {
  17. 17 this.tableLayoutPanel1.ColumnStyles[1].Width = 0;
  18. 18
  19. 19 }
  20. 20 }
  21. this.tableLayoutPanel1.ColumnStyles[1] 为第二列 0为第一列

发表评论

表情:
评论列表 (有 0 条评论,465人围观)

还没有评论,来说两句吧...

相关阅读

    相关 表格可拖拽宽度

    问题 普通表格的列是不能够通过用户操作改变宽度, 即动态改变列的宽度。 有时候, 有的列内容是多的,不够显示, 有的列内容是少的,不用太多宽度显示, 但是内容是动态的,