Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 自转问题_C#_.net - Fatal编程技术网

C# 自转问题

C# 自转问题,c#,.net,C#,.net,我有一个面板,在面板上应该添加一个控件,单击该控件中的按钮。。 我将这些控件停靠在底部,因为我有另一个控件必须始终位于顶部。。。 现在问题是,, 我设置了一个maxsize,这样在达到maxsize后,面板的autoscroll应该启动,并且要求类似于添加控件时,滚动应该向下滑动到最新添加的控件。 我不知道如何达到这个要求 编辑 此代码在控件按钮上单击 SearchCriterionControl control = new SearchCriterionControl(); control.S

我有一个面板,在面板上应该添加一个控件,单击该控件中的按钮。。 我将这些控件停靠在底部,因为我有另一个控件必须始终位于顶部。。。 现在问题是,, 我设置了一个maxsize,这样在达到maxsize后,面板的autoscroll应该启动,并且要求类似于添加控件时,滚动应该向下滑动到最新添加的控件。 我不知道如何达到这个要求

编辑

此代码在控件按钮上单击

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();

这将相应地在面板上放置控件:

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
控件停靠在面板顶部

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


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

请发布一些代码以显示正在进行的操作。此代码位于“控制”按钮上,单击。。。SearchCriterionControl control=新的SearchCriterionControl();control.SupportedMetaDataItems=this.supportedSearchParams;control.AddOrRemoveButtonClick+=新事件处理程序(AddOrRemoveSearchItemsButtonClick);control.Location=新点(SearchCriteriaControl.STARTWIDTH,this.searchCritenControl.Height*(this.pnlSearchItems.Controls.Count-1)+(this.expanderWithLabelSearch.Height)+SearchCriteriaControl.MARGIN*2);这个.SuspendLayout();this.pnlSearchItems.Controls.Add(control);此选项为.resume布局(false);这个。执行布局();control.Focus();这将相应地在面板上放置控件,this.pnlSearchItems.AutoScroll=false;this.pnlSearchItems.Height=this.expanderWithLabelSearch.Height+(numberOfControls)*this.searchCritenControl.Height+SearchCriteriaControl.MARGIN*2;this.tlpSearchBy.Height=this.pnlsearchtems.Height;this.Height=this.pnlSearchItems.Height+his.pnlGroupItems.Height+this.pnlControls.Height+SearchCriteriaControl.MARGIN*4;this.tblGroupBy.Location=新点(SearchCriteriaControl.STARTWIDTH,this.pnlSearchItems.Height+SearchCriteriaControl.MARGIN*2);this.pnlControls.Location=新点(SearchCriteriaControl.STARTWIDTH,this.pnlSearchItems.Height+this.pnlGroupItems.Height+SearchCriteriaControl.MARGIN*2);searchCriterionControl是添加到面板的控件。。。正如我在上面所说的,searchCriterionControl在点击面板时有一个按钮,另一个searchCriterionControl应该添加到面板上。。。SearchCriterionControl停靠在底部,因为这个.expanderWithLabelSearch控件停靠在面板顶部我不知道你是否可以编辑你的问题,但我已经将你的评论中的代码移到了问题中。