2010-06-03 8 views
0

패널이있어서 그 컨트롤의 패널 클릭으로 컨트롤을 추가해야합니다 .. 항상 상단에 있어야하는 다른 컨트롤이 있기 때문에 컨트롤을 아래쪽에 도킹했습니다. 이제 문제는 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 컨트롤이 도킹되어 있기 때문에 하단에 도킹됩니다. pnlSearchItems 스크롤해야 패널 인 경우

+0

진행 상황을 보여주는 코드를 게시하십시오. – JYelton

+0

컨트롤 단추의이 코드를 클릭하십시오. SearchCriterionControl control = new SearchCriterionControl(); control.SupportedMetaDataItems = this.supportedSearchParams; control.AddOrRemoveButtonClick + = 새 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); \t \t \t \t this.PerformLayout(); control.Focus(); – curiosity

+0

그리고 이에 따라 컨트롤을 패널에 배치하려면 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); – curiosity

답변

2

, 당신은 보라 : 패널이 자동 스크롤이 true로 설정해야합니다 것을

.ScrollControlIntoView(Control)

참고.

+0

예. 나는 그것을 시도했다. .. 그러나 그것은 작동하지 않고있다 :( – curiosity