Alex Alex - 2 months ago 22
C# Question

autoscroll panel to bottom

i have a panel in my winforms and in it i load some usercontrols .

i would like to autoscroll to the bottom of the panel( as my panel fills ) everytime a new usercontrol is added . How can i do so ?

Answer

You can do that by setting the VerticalScroll of the Panel but I think it would be better to use ScrollControlIntoView instead.

private void panel1_ControlAdded(object sender, ControlEventArgs e)
{
    panel1.ScrollControlIntoView(e.Control);
}

Good luck!