简体   繁体   中英

Unable to enable scroll in tablelayoutpanel in C#

I am using a tablelayout panel in my project and displaying items in it . but it is not scrollable , i have tried with autoscroll, maximum size and everything else that seems related to scrolling .

Any kind of help will be appreciated , many thanks , plz help

In order to auto scroll show any kind of scroll bar its parent control must be smaller than the TableLayoutPanel itself. Check you parent size and other properties, such as autosize, dock and autosizemode

I'm not sure what you're designing for that control, but it really implemente the interface IScrollable (just like this name, you could view it in object browser).

Here is mine.

// 
        // 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;
        // 

Hope this could help you, I use it just now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM