public Set() { InitializeComponent(); WindowBlur.SetIsEnabled(this, true); WindowXCaption.SetForeground(this, MainWindow.brush); //刷新窗口前景色 updateUI(); Timer timer = new Timer(); timer = new Timer(1000); timer.Elapsed += new ElapsedEventHandler(OnTimedEvent); timer.Enabled = true; if (WindowXCaption.GetHeight(MainWindow.windowMain) == 0) { GD.IsChecked = true; } if (MainWindow.windowMain.fx) { GT.IsChecked = true; } if (MainWindow.wherefind != "全国") { WHERE.Text = MainWindow.wherefind; } TIME.Text = MainWindow.times.ToString(); TOP.IsChecked = MainWindow.top; }
private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is Window window) { if (true.Equals(e.OldValue)) { GetWindowBlur(window)?.Detach(); window.ClearValue(WindowBlurProperty); } if (true.Equals(e.NewValue)) { var blur = new WindowBlur(); blur.Attach(window); window.SetValue(WindowBlurProperty, blur); } } }
public MainWindow() { InitializeComponent(); WindowBlur.SetIsEnabled(this, true); windowMain = this; //刷新窗口前景色 updateUI(); Timer timer = new Timer(); timer = new Timer(1000); timer.Elapsed += new ElapsedEventHandler(OnTimedEvent); timer.Enabled = true; FontFamily font = new FontFamily("方正兰亭简黑"); this.MGET.FontFamily = font; this.MGET.FontSize = 13; this.GET.FontFamily = font; this.GET.FontSize = 23; this.MMAY.FontFamily = font; this.MMAY.FontSize = 13; this.MAY.FontFamily = font; this.MAY.FontSize = 23; this.MMAYDIE.FontFamily = font; this.MMAYDIE.FontSize = 13; this.MAYDIE.FontFamily = font; this.MAYDIE.FontSize = 23; this.MDIE.FontFamily = font; this.MDIE.FontSize = 13; this.DIE.FontFamily = font; this.DIE.FontSize = 23; this.MALIVE.FontFamily = font; this.MALIVE.FontSize = 13; this.ALIVE.FontFamily = font; this.ALIVE.FontSize = 23; this.TOOLTIP.DataContext = toolTip; //开始运行 RunXH(); }
public static void SetWindowBlur(DependencyObject element, WindowBlur value) { element.SetValue(WindowBlurProperty, value); }