我希望按钮的功能如下:
if button is down(mouse button is hold down)
{
bool trySmthing = true;
}
if button is up
{
bool trySmthing = false;
}
我尝试了KeyUp
和KeyDown
个事件,但他们没有给出正确的结果。
答案 0 :(得分:3)
答案 1 :(得分:0)
这应该有所帮助:Micosoft Library for C# Mouse-events
void MouseUpHandler(Object sender, RoutedEventArgs args)
{
// This method is called whenever the PreviewMouseUp event fires.
}
void MouseDownHandler(Object sender, RoutedEventArgs args)
{
// This method is called whenever the PreviewMouseDown event fires.
}