The panel should contain focus (itself or one of its children), then the auto-srcoll feature will work.
The problem which you have with GroupBox
is clicking on it doesn't activate the control, same as Label
or PictureBox
or Panel
itself.
As a simple workaround you can handle Click
event of Panel
or any other control which you want to make auto-scroll work and set it as ActiveControl
of Form
:
private void control_Click(object sender, EventArgs e)
{
this.ActiveControl = (Control)sender;
}
You can do it for the Panel
to enable auto-scroll when you click on an empty area of the panel, or if you want clicking on your GroupBox
or Label
case auto-scroll work, you can do the same for them.