wpf dual monitor

原文:wpf dual monitor

wpf dual monitor
public partial class App : System.Windows.Application
    {

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);           

            SetupWindows();
        }
         
        private void SetupWindows()
        {
            System.Windows.Forms.Screen mainScreen = Screen.AllScreens[0]; ;
            WinLeft leftWin = new WinLeft()
            {
                WindowStartupLocation = WindowStartupLocation.Manual,
                WindowState = System.Windows.WindowState.Normal,
                Left = mainScreen.WorkingArea.Left,
                Top = mainScreen.WorkingArea.Top,
                Width = mainScreen.WorkingArea.Width,
                Height = mainScreen.WorkingArea.Height
            };           

            System.Windows.Forms.Screen secondaryScreen = Screen.AllScreens[1];
            WinRight rightWin = new WinRight()
            {
                WindowStartupLocation = WindowStartupLocation.Manual,
                WindowState = System.Windows.WindowState.Normal,
                Left = secondaryScreen.WorkingArea.Left,
                Top = secondaryScreen.WorkingArea.Top,
                Width = secondaryScreen.WorkingArea.Width,
                Height = secondaryScreen.WorkingArea.Height
            };

           
            leftWin.Show();
            leftWin.WindowState = WindowState.Maximized;
            rightWin.Show();
            rightWin.WindowState = WindowState.Maximized;
            rightWin.Owner = leftWin;
        }
    }
wpf dual monitor

wpf dual monitor

 

wpf dual monitor

上一篇:c#每天生成漂亮桌面背景、英文名言、翻译


下一篇:c# 结构体实现数据新增(数据字段较多的情况使用) 一