How can I scroll my panel using my mousewheel?

Sergio Tapia picture Sergio Tapia · Oct 21, 2009 · Viewed 66.9k times · Source

I have a panel on my form with AutoScroll set to true so a scrollbar appears automatically.

How can I make it so a user can use his mouse wheel to scroll the panel? Thanks SO.

Answer

beam022 picture beam022 · Jan 31, 2012

What worked for me was adding panel1_MouseEnter EventHandler:

private void panel1_MouseEnter(object sender, EventArgs e)
{
    panel1.Focus();
}