I have a Panel
in which i'm adding controls to it dynamically. I want to scroll the Panel
to the position of one given control of the Panel
I'm using the ScrollControlIntoView
method of the ScrollableControl
object as follows:
public void centerPanel(Control p){
panel.ScrollControlIntoView(p);
}
But the panel seems to move to random positions.
The AutoScroll
property is set to True
in the Panel
.
Any thoughts ?
I have detected my mistake. I was scrolling the Panel
before adding the Control
to the Panel
.
So, here is the correct way to scroll a Panel
to a given control.
panel.Controls.Add(control);
panel.ScrollControlIntoView(control);
Thanks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.