开发者

How to raise mouse events from code behind in different positions of screen?

How to raise mouse button events from code behind when we have onl开发者_如何学运维y mouse position? I need to raise mouse events from code behind in different positions of screen.


Umm.. quite simply no you can't.

Edit

Now that you've describe what it is you actually need to do (a useful techinque in getting your problems solved). Here is the solution:-

Use the AddHandler method to attach a handler for the MouseLeftButtonDown and the MouseLeftButtonUp.

myPanel.AddHandler(UIElement.MouseLeftButtonDown, MyButtonDown_Handler, true);

Note the final true parameter is the enabler here, it indicates that your handler should be called even if another element has indicated that the event has been handled.

Whilst you cannot add a handler for MouseMove in this way that is not a problem since MouseMove cannot be marked as handled anyway, so you just attach a handler to the Panel for MouseMove in the normal manner.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜