How can I scroll my panel using my mousewheel?

前端 未结 9 1556
情歌与酒
情歌与酒 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:51

    Moving the scroll wheel should trigger the control's MouseMove event. The MouseEventArgs argument has a property named Delta, which gives the (signed) number of notches that the mouse wheel has moved. You can use this property to scroll the panel.

提交回复
热议问题