【问题标题】:Unable to enable scroll in tablelayoutpanel in C#无法在 C# 的 tablelayoutpanel 中启用滚动
【发布时间】:2012-08-04 02:33:42
【问题描述】:

我在我的项目中使用了一个表格布局面板并在其中显示项目。但它不可滚动,我尝试过使用自动滚动、最大尺寸以及与滚动相关的所有其他内容。

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

【问题讨论】:

标签: c# scroll tablelayoutpanel


【解决方案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;
        // 

希望对你有帮助,我现在才用。

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2011-09-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-15
      • 2023-03-05
      • 2013-10-26
      • 2015-12-01
      • 1970-01-01
      相关资源
      最近更新 更多