Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个可以捕捉光标的橡皮筋。如果光标到达面板边缘,如何滚动面板?如果您需要更多信息,请告诉我,我认为它可以自行解释。
您需要使用 MouseMove 事件并检查按钮是否按下并且光标是否位于面板边缘附近。说在 5 像素以内。如果是这种情况,请启用一个计时器,它应该在 ~200 毫秒时滴答作响。在 Tick 事件处理程序中调整面板的 AutoScrollPosition 属性以使其滚动。
请记住,有效的鼠标位置是 e.Location 加上 AutoScrollPosition。