/// <summary> /// 事件:键盘即将松开按钮 /// </summary> private void window_PreviewKeyUp(object sender, KeyEventArgs e) { if (e.SystemKey == Key.LeftAlt || e.SystemKey == Key.RightAlt) { MainWindow.altDown = false; } SemaphoreDispatcher.Deactivate($"System_Key_{e.Key}"); }
/// <summary> /// 提供精灵按钮鼠标离开时的处理函数 /// </summary> /// <param name="sender">触发者</param> /// <param name="e">鼠标参数</param> public void MouseLeaveHandler(object sender, MouseEventArgs e) { if (this.Enable) { this.IsMouseOver = this.IsMouseOn = false; SemaphoreDispatcher.Deactivate($"System_Button_Over_{this.Id}"); if (this.DisplayBinding != null && (this.ImageMouseOver != null || this.ImageMouseOn != null)) { BitmapImage myBitmapImage = this.ImageNormal.SpriteBitmapImage; //this.ImageNormal.DisplayBinding = this.DisplayBinding; this.DisplayBinding.Width = myBitmapImage.PixelWidth; this.DisplayBinding.Height = myBitmapImage.PixelHeight; this.DisplayBinding.Source = myBitmapImage; } } }