判断屏幕数量及跳转

if (Screen.AllScreens.Length == 2)
{
    //此显示器是否为主屏
    if (Screen.AllScreens[0].Primary)
    {
        this.Top = Screen.AllScreens[1].Bounds.Y;
        this.Left = Screen.AllScreens[1].Bounds.X;
    }
    else
    {
        this.Top = Screen.AllScreens[0].Bounds.Y;
        this.Left = Screen.AllScreens[0].Bounds.X;
    }
}
else if (Screen.AllScreens.Length == 3)
{
    this.Top = Screen.AllScreens[2].Bounds.Y;
    this.Left = Screen.AllScreens[2].Bounds.X;
}

posted on 2020-12-22 08:42  mol1995  阅读(183)  评论(0编辑  收藏  举报

导航