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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With