private void OnAeroColorChanged(object sender, EventArgs e) { this.titleBar.Dispatcher.BeginInvoke((Action) delegate { this.titleBar.Background = AeroHelper.TryGetAeroColor(); this.titleBar.Foreground = System.Windows.SystemColors.ActiveCaptionTextBrush; }); }
protected override void OnPaintBackground(PaintEventArgs e) { base.OnPaintBackground(e); if (AeroHelper.DwmIsCompositionEnabled()) { e.Graphics.Clear(Color.Black); } }
protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); if (AeroHelper.IsAeroEnabled) { AeroHelper.ExtendGlassFrame(this, new Thickness(0, CustomTitlebar.TitlebarHeightInPixels, 0, 0)); } }
private void FrmSkGl_Load(object sender, System.EventArgs e) { if (AeroHelper.DwmIsCompositionEnabled()) { var margins = AeroHelper.NewMargins((Width + Height) * 2); AeroHelper.DwmExtendFrameIntoClientArea(Handle, ref margins); } }
private void FrmNoneBorderMove_Load(object sender, EventArgs e) { if (AeroHelper.DwmIsCompositionEnabled()) { var hind = new DWM_BLURBEHIND { dwFlags = DWM_BLURBEHIND_Mask.DWM_BB_ENABLE | DWM_BLURBEHIND_Mask.DWM_BB_BLURREGION | DWM_BLURBEHIND_Mask.DWM_BB_TRANSITIONONMAXIMIZED, fEnable = true, TransitionOnMaximized = true, }; DwmEnableBlurBehindWindow(Handle, hind); } }
private async void Form1_Load(object sender, EventArgs e) { if (AeroHelper.DwmIsCompositionEnabled()) { var margins = AeroHelper.NewMargins((Width + Height) * 2); AeroHelper.DwmExtendFrameIntoClientArea(Handle, ref margins); } IsAnimation = true; await LoadWebImage(); LoadResourceImage(); await AnimationLoop(); }
protected virtual void OnLoaded(object sender, RoutedEventArgs e) { // Inserting a custom titlebar before the window's content var grid = new Grid(); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(CustomTitlebar.TitlebarHeightInPixels + 4, GridUnitType.Pixel) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star), }); this.titleBar = new CustomTitlebar(); this.titleBar.Loaded += (ss, ee) => { this.titleBar.Foreground = System.Windows.SystemColors.ActiveCaptionTextBrush; AeroHelper.AeroColorChanged += OnAeroColorChanged; if (AeroHelper.IsAeroEnabled) { var aeroColor = AeroHelper.TryGetAeroColor(); if (aeroColor != null) { this.titleBar.Background = aeroColor; } } else { this.titleBar.Background = System.Windows.SystemColors.ActiveCaptionBrush; } }; var content = this.Content as UIElement; this.Content = null; Grid.SetRow(this.titleBar, 0); Grid.SetRow(content, 1); grid.Children.Add(this.titleBar); grid.Children.Add(content); this.Content = grid; if (this.IsToolWindow) { this.MinWidth = this.ActualWidth; this.MaxWidth = this.ActualWidth; this.MinHeight = this.ActualHeight; this.MaxHeight = this.ActualHeight; } }
public FrmOpenCv() { InitializeComponent(); if (AeroHelper.DwmIsCompositionEnabled()) { var hind = new DWM_BLURBEHIND { dwFlags = DWM_BLURBEHIND_Mask.DWM_BB_ENABLE | DWM_BLURBEHIND_Mask.DWM_BB_BLURREGION | DWM_BLURBEHIND_Mask.DWM_BB_TRANSITIONONMAXIMIZED, fEnable = true, TransitionOnMaximized = true, }; DwmEnableBlurBehindWindow(Handle, hind); } }
private void WindowPlus_Loaded(object sender, RoutedEventArgs e) { UpdateLayerSize(); UpdateLayerLocation(); SizeChanged += WindowPlus_SizeChanged; //WindowStyleHelper.SetOpacity(this, 0.6); if (SystemHelper.IsWindow10 && Aero) { aeroLayer.Show(); Owner = aeroLayer; AeroHelper.EnableAero(aeroLayer, Shadow); } else { SetShadowRadius(ShadowRadius); SetShadowOpacity(ShadowOpacity); shadowLayer.Show(); Owner = shadowLayer; } if (WindowEntrance == WindowEntrance.Fade) { DoubleAnimation showAnimation = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(WindowEntranceTime))); showAnimation.CurrentTimeInvalidated += (s, e2) => { WindowStyleHelper.SetOpacity(aeroLayer, Opacity); }; showAnimation.Completed += (s, e2) => { WindowStyleHelper.SetOpacity(aeroLayer, Opacity); }; BeginAnimation(OpacityProperty, showAnimation); } else if (WindowEntrance == WindowEntrance.None) { Opacity = 1; shadowLayer.Opacity = 1; } Focus(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { mainWindow.Closed += (s, ee) => { try { Close(); } catch { } }; string bgPath = Environment.CurrentDirectory + ConfigSetting.GetXmlValue("skinBg", "path"); SetBackgroundFromName(bgPath); //(backOpPanel.Background as ImageBrush).ImageSource = new BitmapImage(new Uri(bgPath, UriKind.Absolute)); if (SystemHelper.IsWindow10)//判断是否为win10 { //CompositionTarget.Rendering += WindowPositionChangeWithAero; AeroHelper.EnableAero(this, true); Width = Width - ShadowMargin.Left - ShadowMargin.Right - 2; Height = Height - ShadowMargin.Top - ShadowMargin.Bottom - 2; mainGrid.Margin = new Thickness(-1, -25, -1, -1); ShadowMargin = new Thickness(0); backOpPanel.SetValue(Grid.RowSpanProperty, 1); backBlur.SetValue(Grid.RowSpanProperty, 1); backWhite.SetValue(Grid.RowSpanProperty, 1); WindowEntranceBackgroundMode = 5; } else { //CompositionTarget.Rendering += WindowPositionChange; } mainWindow.Show(); OnLocationChanged(new EventArgs()); mainGrid.Visibility = Visibility.Visible; }