C#中UserControl中的滚动条

时间:2014-03-10 09:38:16

标签: c# winforms user-controls

我已经在TabPage中添加了一个UserControl。

Tabpage.AutoScroll = true; 

启动应用程序后,只有垂直滚动条。当我横向调整应用程序的大小时,没有滚动条。

  

Tabcontrol-> TabPage - >用户控件

enter image description here

enter image description here

        // tabPage
        // 
        this.tab_resume_new.Controls.Add(this.userControlResume);
        this.tab_resume_new.Location = new System.Drawing.Point(4, 29);
        this.tab_resume_new.Name = "tabPage";
        this.tab_resume_new.Size = new System.Drawing.Size(1270, 635);

在UserControl中

 // UserControl
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.AutoScroll = true;
            this.Controls.Add(this.tableLayoutPanel8);
            this.Name = "UserControlResume";
            this.Size = new System.Drawing.Size(1260, 625)

2 个答案:

答案 0 :(得分:3)

在这种情况下,通常只会出现一些问题。

1)您需要将AutoScroll放在UserControl上

2)tablPage上的控件将Anchor设置为Right ..如果你有Right,那么水平滚动条将不会显示。

3)您有嵌套控件和tabPage中的包装器控件。该包装器控件不超过标签页边界。

答案 1 :(得分:0)

通过为表单设置MinimumSize,当您将大小减小到小于MinimumSize时,它会自动插入滚动