首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >autoscroll问题

autoscroll问题
EN

Stack Overflow用户
提问于 2010-06-03 16:01:18
回答 1查看 1.2K关注 0票数 0

我有一个面板,在该控件中的按钮的面板上应该添加一个控件。我把这些控件停靠在底部,因为我有另一个必须一直在顶部的控件.现在的问题是,我设置了一个maxsize,这样在达到maxsize之后,面板的自动滚动框应该启动,并且要求类似于添加控件时的,滚动应该滑到最新添加的控件.我不知道如何实现该要求.

编辑

此代码在“控件”按钮上单击..。

代码语言:javascript
复制
SearchCriterionControl control = new SearchCriterionControl();
control.SupportedMetaDataItems = this.supportedSearchParams;
control.AddOrRemoveButtonClick += new EventHandler(AddOrRemoveSearchItemsButtonClick);
control.Location = new Point(SearchCriteriaControl.STARTWIDTH, this.searchCritenControl.Height * (this.pnlSearchItems.Controls.Count - 1) + (this.expanderWithLabelSearch.Height) + SearchCriteriaControl.MARGIN * 2);
this.SuspendLayout();
this.pnlSearchItems.Controls.Add(control);
this.ResumeLayout(false);
this.PerformLayout();
control.Focus();

并将相应的控件放置在面板上:

代码语言:javascript
复制
this.pnlSearchItems.AutoScroll = false;
this.pnlSearchItems.Height = this.expanderWithLabelSearch.Height + (numberOfControls) * this.searchCritenControl.Height + SearchCriteriaControl.MARGIN * 2;
this.tlpSearchBy.Height = this.pnlSearchItems.Height;
this.Height = this.pnlSearchItems.Height + his.pnlGroupItems.Height + this.pnlControls.Height + SearchCriteriaControl.MARGIN * 4;
this.tblGroupBy.Location = new Point(SearchCriteriaControl.STARTWIDTH, this.pnlSearchItems.Height + SearchCriteriaControl.MARGIN * 2);
this.pnlControls.Location = new Point(SearchCriteriaControl.STARTWIDTH, this.pnlSearchItems.Height + this.pnlGroupItems.Height + SearchCriteriaControl.MARGIN * 2);

searchCriterionControl是添加到面板中的控件.正如我前面所说,searchCriterionControl有一个按钮,点击另一个searchCriterionControl应该在面板上添加.SearchCriterionControl被停靠到底部,this.expanderWithLabelSearch控件被停靠在面板的顶部。

EN

回答 1

Stack Overflow用户

发布于 2010-06-03 16:31:31

如果pnlSearchItems是应该滚动的面板,则应该查看:

.ScrollControlIntoView(Control)

注意,面板必须将AutoScroll设置为true。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2967689

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档