C# 将窗口显示在指定屏幕

            Form Frm2 = new Form2();
            Frm2.Show();

            Screen[] screens = Screen.AllScreens;//获取当前所有显示屏
            int count = screens.Count();
            foreach (Form frm in Application.OpenForms)
            {
                if (frm is Form2)
                {
                    frm.StartPosition = FormStartPosition.Manual;
                    frm.Location = new Point(screens[count - 1].Bounds.Left, screens[count - 1].Bounds.Top);//将窗口显示在第二个显示屏
                    frm.WindowState = FormWindowState.Maximized;
                }
            }

 

posted @ 2022-06-23 10:30  芈璐  阅读(1182)  评论(0编辑  收藏  举报