private void SetFormLocation(Screen screen) { if (showCauGoc != null) { showCauGoc.Close(); } showCauGoc = new ShowCauGoc(); if (screen == null) { throw new ArgumentNullException("screen"); } var mainWindowPresentationSource = PresentationSource.FromVisual(this); if (mainWindowPresentationSource != null) { if (mainWindowPresentationSource.CompositionTarget != null) { var m = mainWindowPresentationSource.CompositionTarget.TransformToDevice; var dpiWidthFactor = m.M11; var dpiHeightFactor = m.M22; showCauGoc.Top = screen.WorkingArea.Top / dpiHeightFactor; showCauGoc.Left = screen.WorkingArea.Left / dpiWidthFactor; showCauGoc.Width = screen.WorkingArea.Width / dpiWidthFactor; showCauGoc.Height = screen.WorkingArea.Height / dpiHeightFactor; } } showCauGoc.WindowState = WindowState.Normal; showCauGoc.Show(); caugoc_SelectionChanged(null, null); }
private void SetFormLocation( Screen screen) { if (showCauGoc!=null) showCauGoc.Close(); showCauGoc = new ShowCauGoc(); if (screen == null) throw new ArgumentNullException("screen"); var mainWindowPresentationSource = PresentationSource.FromVisual(this); if (mainWindowPresentationSource != null) { if (mainWindowPresentationSource.CompositionTarget != null) { var m = mainWindowPresentationSource.CompositionTarget.TransformToDevice; var dpiWidthFactor = m.M11; var dpiHeightFactor = m.M22; showCauGoc.Top = screen.WorkingArea.Top / dpiHeightFactor; showCauGoc.Left = screen.WorkingArea.Left / dpiWidthFactor; showCauGoc.Width = screen.WorkingArea.Width / dpiWidthFactor; showCauGoc.Height = screen.WorkingArea.Height / dpiHeightFactor; } } showCauGoc.WindowState = WindowState.Normal; showCauGoc.Show(); caugoc_SelectionChanged(null, null); }