开发者

Endless calls of Control.OnMouseMove after calling Refresh

开发者 https://www.devze.com 2023-02-18 05:48 出处:网络
I was overriding the OnMouseMove method to write the current coordinates to my control. The problem is that I have to trigger the OnPaint method to refresh the values. If I use Refresh (开发者_开发知识

I was overriding the OnMouseMove method to write the current coordinates to my control. The problem is that I have to trigger the OnPaint method to refresh the values. If I use Refresh (开发者_开发知识库or even Invalidate) in the OnMouseMove an endless cascade of MouseMove events is triggered. Even if I don't move the mouse the events are raised with X and Y values zero. Why is that? And is there a better way to handle my problem than checking whether X and Y are zero before calling Refresh?

Thanks for help, Werner

I'm using .Net 3.5 on Windows XP and this topic is referring to System.Windows.Forms.


Does your event handling cause another OnPaint invocation? Are you debugging where switching between VS.Net and your app is causing the repaint each time you hit the break point?

0

精彩评论

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