How can I scroll my panel using my mousewheel?

前端 未结 9 1563
情歌与酒
情歌与酒 2021-01-17 09:19

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?

9条回答
  •  南笙
    南笙 (楼主)
    2021-01-17 09:52

    What worked for me was adding panel1_MouseEnter EventHandler:

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

提交回复
热议问题