// 最大化按钮 private void MaximizedButton_Click(object sender, RoutedEventArgs e) { if (this.WindowState == WindowState.Maximized) { this.WindowState = WindowState.Normal; MaximizedButton.SetResourceReference(BackgroundProperty, "MaximizeButtonBrush"); } else { this.WindowState = WindowState.Maximized; MaximizedButton.SetResourceReference(BackgroundProperty, "RestoreButtonBrush"); } }
private void MouseLeftClick(object sender, MouseEventArgs e) { i += 1; DispatcherTimer timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 0, 0, 300); timer.Tick += (s, e1) => { timer.IsEnabled = false; i = 0; }; timer.IsEnabled = true; if (i % 2 == 0) { timer.IsEnabled = false; i = 0; if (this.WindowState == WindowState.Maximized) { this.WindowState = WindowState.Normal; MaximizedButton.SetResourceReference(BackgroundProperty, "MaximizeButtonBrush"); } else { this.WindowState = WindowState.Maximized; MaximizedButton.SetResourceReference(BackgroundProperty, "RestoreButtonBrush"); } } }