问题
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
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/11839846/unable-to-enable-scroll-in-tablelayoutpanel-in-c-sharp