代码之家  ›  专栏  ›  技术社区  ›  Chris S

我应该使用Screen.PrimaryMonitor还是Screen.AllScreens来设置窗体位置?

  •  0
  • Chris S  · 技术社区  · 17 年前

    根据问题的建议,我是否应该检查矩形以根据以下内容设置Form.Location(取自设置文件):

    1.

    if (settings.X <  Screen.PrimaryScreen.WorkingArea...)
    {
      // Set the form's Location based on the settings object
    }
    

    2.

    int width = 0;
    foreach (Screen screen in Screen.AllScreens)
    {
        width += screen.WorkingArea.Width;
    }
    
    if (settings.X <  width...)
    {
      // Set the form's Location based on the settings object
    }
    

    还是有一个简单的单行程序可以完成#2的任务?我正在使用双监视器,但用户群可能有任意数量的配置。

    1 回复  |  直到 17 年前
    推荐文章