简体   繁体   English

是类似于c#WPF中的keylistener

[英]Is something like keylistener in c# WPF

What i need is after move with mouse on button call function. 我需要的是移动鼠标后调用按钮的功能。 In java, there is mouselistener and method what do it. 在Java中,有mouselistener和method可以做到这一点。 How i can make it in C# WPF? 我如何在C#WPF中做到这一点? Is there something similar? 有类似的东西吗?

I tried google but find nothing. 我尝试谷歌,但一无所获。

Add element on XAML 在XAML上添加元素

<Button ....... MouseMove="Button1MouseMove">

in your file.cs 在您的file.cs中

private void Button1MouseMouve(object sender,MouseEventArgs e)
{
    Point position = e.GetPosition(this);
    int mouse_x = position.x;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM