一个简单的,小程序,用于显示到指定屏幕
namespace DoubleScreen
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
try
{
//设置窗体无边框
this.FormBorderStyle = FormBorderStyle.None;
//窗口置顶
this.TopMost = true;
//开始位置由 Location 决定
this.StartPosition = FormStartPosition.Manual;
Screen[] screens = System.Windows.Forms.Screen.AllScreens;
if (screens.Length >= 2)
{
//获取扩展屏
Screen childerScreen = screens[1];
//设置宽高
this.Width = childerScreen.Bounds.Width;
this.Height = childerScreen.Bounds.Height;
//设置显示位置
this.Location = childerScreen.WorkingArea.Location;
}
else
{
MessageBox.Show(“只有一个显示器”);
}
}
catch (Exception ex)
{
//错误日志处理
}