protected override void OnActivated(EventArgs e) { if (!activatedOnce) { activatedOnce = true; UIHelpers.TopmostFix(this); } }
protected override void OnActivated(EventArgs e) { if (!activatedOnce) { activatedOnce = true; UIHelpers.TopmostFix(this); this.KeyUp += OverlayWindow_KeyUp; } }
private void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e) { Dispatcher.BeginInvoke(new Action(delegate() { this.Width = Util.ScreenBounds.Width; this.Height = Util.ScreenBounds.Height; this.baseGrid.Width = Util.ScreenBounds.Width; this.baseGrid.Height = Util.ScreenBounds.Height; UIHelpers.TopmostFix(this); })); }
private void updateWindowToScreen(System.Windows.Forms.Screen screen) { Console.WriteLine("Setting overlay window position to " + screen.Bounds); //this.Left = screen.Bounds.X; //this.Top = screen.Bounds.Y; PresentationSource source = PresentationSource.FromVisual(this); Matrix transformMatrix = source.CompositionTarget.TransformToDevice; this.Width = screen.Bounds.Width * transformMatrix.M22; this.Height = screen.Bounds.Height * transformMatrix.M11; this.scrollViewer.MaxHeight = this.Height - 200; UIHelpers.SetWindowPos((new WindowInteropHelper(this)).Handle, IntPtr.Zero, screen.Bounds.X, screen.Bounds.Y, screen.Bounds.Width, screen.Bounds.Height, UIHelpers.SetWindowPosFlags.SWP_NOACTIVATE | UIHelpers.SetWindowPosFlags.SWP_NOZORDER); this.baseGrid.Width = this.Width; this.baseGrid.Height = this.Height; this.baseCanvas.Width = this.Width; this.baseCanvas.Height = this.Height; UIHelpers.TopmostFix(this); }