C# winfrom 投屏显示窗体,可以显示在指定的屏幕,有多个屏幕都可以显示

C# winfrom 投屏显示窗体,可以显示在指定的屏幕,有多个屏幕都可以显示

 

C# winfrom 投屏显示窗体,可以显示在指定的屏幕,有多个屏幕都可以显示_第1张图片

 

核心代码:

 public void FormStartScreen(int screen, Form form)
        {
            if (Screen.AllScreens.Length < screen)
            {
                MessageBox.Show("当前主机连接最多的屏幕是" + Screen.AllScreens.Length + " 个,不能投屏到第"+ screen + "个 屏幕!");
                return;
            }
            screen = screen-1;
            if (form==null)
            {
                form =new Form ();
            }
            form.StartPosition = FormStartPosition.CenterScreen;
            Screen s = Screen.AllScreens[screen];
            form.Location = new System.Drawing.Point(s.Bounds.X, s.Bounds.Y);
            //form.WindowState = FormWindowState.Maximized;
            form.Size = new Size(s.WorkingArea.Width, s.WorkingArea.Height);

            form.Show();
            form.BringToFront();
        }

下载地址:https://download.csdn.net/download/tanglingbo/11604802

你可能感兴趣的:(C#)