0

I've got a scrollable panelcontrol with multiple groupboxes, but when my mouse is within a groupbox, the scrolling does not work for my complete site, only, when i leave the groupboxes.

Is there a solution for it, so, that I can scroll, even my mouse is in a groupbox?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
  • 1
    There are a few answers documenting how to make a control pass mouse events to its parent. Here is one example that I've used myself: http://stackoverflow.com/questions/547172/pass-through-mouse-events-to-parent-control – Equalsk Oct 10 '16 at 15:03
  • OK, thank you. Works fine. – user2849380 Oct 10 '16 at 15:12

1 Answers1

1

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.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398