Scroll when rubber band reaches edge of panel

≯℡__Kan透↙ 提交于 2019-12-11 10:46:54

问题


I have a rubber band that captures the cursor. How can I scroll a panel if the cursor reaches the edge of the panel? Let me know if you need more info, I think it explains itself.


回答1:


You need to use the MouseMove event and check if the button is down and the cursor is located close to the edge of the panel. Say within 5 pixels. Enable a timer if that's the case, it should tick at ~200 msec. In the Tick event handler adjust the panel's AutoScrollPosition property to make it scroll.

Keep in mind that the effective mouse position is e.Location plus AutoScrollPosition.



来源:https://stackoverflow.com/questions/5067366/scroll-when-rubber-band-reaches-edge-of-panel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!