我有一个面板,并且应该在面板上添加一个控件,点击该控件中的按钮。 我将这些控件停靠在底部,因为我有另一个控件必须始终位于顶部... 现在的问题是, 我设置了一个maxsize,以便在达到maxsize之后,面板的自动滚动应该启动,并且要求就像当添加一个控件时,滚动应该向下滑动到最新添加的控件.. 我不知道如何达到这个要求......
修改
控件按钮上的此代码单击...
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
控件停靠在面板顶部。
答案 0 :(得分:2)