简体   繁体   English

如何在tabcontrol / tabpages中添加垂直滚动条

[英]how to add vertical scroll bars in tabcontrol/tabpages

I am designing an application in which i am using tab-control, and in one of the tab-page the information i want to display in bigger than the form size, the information is displayed in various text-boxes. 我正在设计一个应用程序,我在其中使用制表符控件,并且在其中一个标签页中,我希望以大于表单大小的方式显示信息,信息显示在各种文本框中。 i tried by adding following lines in designer code but it is still not working. 我尝试在设计器代码中添加以下行,但它仍然无法正常工作。

this.AutoScroll = true;
this.AutoScrollMargin = new System.Drawing.Size(20, 20);
this.AutoScrollMinSize = new System.Drawing.Size(this.Width, this.Height);

any help would be appreciated. 任何帮助,将不胜感激。

You have to set the AutoScroll on the TabPage , not the Form , you can do this at design time by selecting your tabpage first, then set the AutoScroll to true in the Properties window , or you can do by code like this: 您必须在TabPage而不是Form上设置AutoScroll ,您可以在设计时通过首先选择tabpage,然后在Properties窗口中将AutoScroll设置为true来执行此操作,或者您可以通过以下代码执行:

 tabPage1.AutoScroll = true;
 //do the same for other tabPages

notice that "this" refer to whole class(your form). 注意“这个”是指全班(你的表格)。

increase the value like this : 增加这样的值:

tab.AutoScrollMinSize= new System.Drawing.Size(1000,1000);

or you can add panel1 to your tab,then dock it to tab. 或者您可以将panel1添加到选项卡,然后将其停靠到选项卡。 like this : 像这样 :

panel1.dock=dockingSyle.Fill;

now you can make panel1 scrollable. 现在你可以使panel1可滚动了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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