我想TableLayoutPanel
在 GUI 的固定区域中动态添加行。因此,如果记录数量增加,那么我想要一个垂直滚动条来帮助用户查看更多记录。为此,我设置了属性AutoScroll = true;
,但它不起作用。
CheckBox c = new CheckBox();
c.Text = "Han";
tableLayoutPanel1.GrowStyle = TableLayoutPanelGrowStyle.AddRows;
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.AutoSize));
this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.Controls.Add(c, 0, 0);
tableLayoutPanel1.AutoScrollPosition = new Point(0, tableLayoutPanel1.VerticalScroll.Maximum);
this.tableLayoutPanel1.AutoScroll = true;
tableLayoutPanel1.Padding = new Padding(0, 0, SystemInformation.VerticalScrollBarWidth, 0);