无法在C#中的tablelayoutpanel中启用滚动

时间:2012-08-07 05:37:16

标签: c# scroll tablelayoutpanel

我在项目中使用tablelayout面板并在其中显示项目。但它不可滚动,我尝试过使用autoscroll,最大尺寸以及其他与滚动相关的内容。

任何形式的帮助将不胜感激,非常感谢,请帮助

2 个答案:

答案 0 :(得分:1)

为了自动滚动显示任何类型的滚动条,其父控件必须小于TableLayoutPanel本身。 检查父级大小和其他属性,例如 autosize,dock和autosizemode

答案 1 :(得分:1)

我不确定你为该控件设计了什么,但它确实实现了接口IScrollable(就像这个名字一样,你可以在对象浏览器中查看它。)

这是我的。

// 
        // tableLayoutPanel1
        // 
        this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
        | System.Windows.Forms.AnchorStyles.Left)));
        this.tableLayoutPanel1.AutoScroll = true;
        this.tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
        this.tableLayoutPanel1.ColumnCount = 2;
        this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
        this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
        this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12);
        this.tableLayoutPanel1.Name = "tableLayoutPanel1";
        this.tableLayoutPanel1.RowCount = 1;
        this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
        this.tableLayoutPanel1.Size = new System.Drawing.Size(686, 515);
        this.tableLayoutPanel1.TabIndex = 0;
        // 

希望这可以帮到你,我现在就用它。