autoscroll problem
Posted
by deepasundarip
on Stack Overflow
See other posts from Stack Overflow
or by deepasundarip
Published on 2010-06-03T16:01:18Z
Indexed on
2010/06/03
16:24 UTC
Read the original article
Hit count: 200
I have a panel and in that a control should get added on the panel click of the button in that control.. I docked those controls to bottom since i have another control which has to be at top always... Now the problem is, I set a maxsize so that after the maxsize is reached the autoscroll of the panel should kick in, and the requirement is like when a control is added, scroll should slide down to the latest added control.. I don't know how to achieve that requirement...
Edit
this code on the controls button click...
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();
And this to place the controls accordingly on panel:
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);
© Stack Overflow or respective owner