internal GlowWindow(Window owner, GlowWindowProcessor processor) { this.owner = owner; this.processor = processor; this.WindowStyle = WindowStyle.None; this.AllowsTransparency = true; this.ShowActivated = false; this.Visibility = Visibility.Collapsed; this.ResizeMode = ResizeMode.NoResize; this.WindowStartupLocation = WindowStartupLocation.Manual; this.Left = processor.GetLeft(owner.Left, owner.ActualWidth); this.Top = processor.GetTop(owner.Top, owner.ActualHeight); this.Width = processor.GetWidth(owner.Left, owner.ActualWidth); this.Height = processor.GetHeight(owner.Top, owner.ActualHeight); this.Orientation = processor.Orientation; this.HorizontalContentAlignment = processor.HorizontalAlignment; this.VerticalContentAlignment = processor.VerticalAlignment; var bindingActive = new Binding("BorderBrush") { Source = this.owner, }; this.SetBinding(ActiveGlowBrushProperty, bindingActive); var bindingInactive = new Binding("InactiveBorderBrush") { Source = this.owner, }; this.SetBinding(InactiveGlowBrushProperty, bindingInactive); }
private void UpdateCore() { if (this.ownerHandle == IntPtr.Zero) { this.ownerHandle = new WindowInteropHelper(this.owner).Handle; } this.IsGlow = this.owner.IsActive; var dpi = this.GetSystemDpi(); var left = (int)Math.Round(processor.GetLeft(owner.Left, owner.ActualWidth) * dpi.ScaleX); var top = (int)Math.Round(processor.GetTop(owner.Top, owner.ActualHeight) * dpi.ScaleY); var width = (int)Math.Round(processor.GetWidth(owner.Left, owner.ActualWidth) * dpi.ScaleX); var height = (int)Math.Round(processor.GetHeight(owner.Top, owner.ActualHeight) * dpi.ScaleY); NativeMethods.SetWindowPos(this.handle, this.ownerHandle, left, top, width, height, SWP.NOACTIVATE); }
internal GlowWindow(Window owner, GlowWindowProcessor processor) { this.owner = owner; this.processor = processor; this.WindowStyle = WindowStyle.None; this.AllowsTransparency = true; this.ShowActivated = false; this.Visibility = Visibility.Collapsed; this.ResizeMode = ResizeMode.NoResize; this.WindowStartupLocation = WindowStartupLocation.Manual; this.Left = processor.GetLeft(owner.Left, owner.ActualWidth); this.Top = processor.GetTop(owner.Top, owner.ActualHeight); this.Width = processor.GetWidth(owner.Left, owner.ActualWidth); this.Height = processor.GetHeight(owner.Top, owner.ActualHeight); this.Orientation = processor.Orientation; this.HorizontalContentAlignment = processor.HorizontalAlignment; this.VerticalContentAlignment = processor.VerticalAlignment; }