How can I scroll my panel using my mousewheel?

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

    The solution (seen above) provided by Beam022 worked for me while many of the other solutions did not. In my case, I was attempting to scroll a DataGridView control with the mousewheel event.

    The DataGridView_MouseWheel event handler was being called but the FirstDisplayedScrollingRowIndex value never changed. The value was always '0' even after explicitly setting it to 1. It's as if the property were read only.

    Still repro's in .Net Framework 4.6.

提交回复
热议问题