开发者

Scroll when rubber band reaches edge of panel

开发者 https://www.devze.com 2023-02-12 03:47 出处:网络
I have a开发者_JAVA百科 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.You ne

I have a开发者_JAVA百科 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消