Exemple #1
0
        /// <summary>
        /// Paremetredeki pencere hangi ekranda?
        /// </summary>
        /// <param name="window"></param>
        /// <returns></returns>
        public static WpfScreen GetScreenFrom(Window window)
        {
            WindowInteropHelper windowInteropHelper = new WindowInteropHelper(window);
            Screen    screen    = System.Windows.Forms.Screen.FromHandle(windowInteropHelper.Handle);
            WpfScreen wpfScreen = new WpfScreen(screen);

            return(wpfScreen);
        }
Exemple #2
0
        /// <summary>
        /// Paremetredeki point hangi ekranda?
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        public static WpfScreen GetScreenFrom(System.Windows.Point point)
        {
            int x = (int)Math.Round(point.X);
            int y = (int)Math.Round(point.Y);

            System.Drawing.Point drawingPoint = new System.Drawing.Point(x, y);
            Screen    screen    = System.Windows.Forms.Screen.FromPoint(drawingPoint);
            WpfScreen wpfScreen = new WpfScreen(screen);

            return(wpfScreen);
        }
Exemple #3
0
        public WpfScreenManager(Window window)
        {
            this.window = window;
            this.OnCurrentScreenChanged += (args) => { System.Diagnostics.Debug.WriteLine("Primary screen changed : " + args.NewScreen.DeviceName); };
            Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;

            this.ScreenList = WpfScreen.AllScreens().OrderBy(x => x.DeviceBounds.X).ToList();
            this.UpdateCurrentScreen();

            Current = this;
        }
Exemple #4
0
        void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
        {
            this.ScreenList = WpfScreen.AllScreens().OrderBy(x => x.DeviceBounds.X).ToList();
            this.UpdateCurrentScreen();

            var handler = this.DisplaySettingsChanged;

            if (handler != null)
            {
                handler(this, new EventArgs());
            }
        }
Exemple #5
0
 public CurrentScreenChangeEventArgs(WpfScreen oldScreen, WpfScreen newScreen)
 {
     this.OldScreen = oldScreen;
     this.NewScreen = newScreen;
 }