【问题标题】:How can I select the monitor where I want to open my application? [duplicate]如何选择要打开应用程序的显示器? [复制]
【发布时间】:2010-09-18 14:43:05
【问题描述】:

可能重复:
Start program on a second monitor?

我有两台显示器,一台显示器连接到我的笔记本电脑。如何选择将显示我的应用程序的监视器?

另外,我如何检测我连接了多少台显示器以便我可以选择一台?

谢谢

【问题讨论】:

标签: delphi multiple-monitors


【解决方案1】:

使用Screen 对象。

获取监视器计数

ShowMessage(IntToStr(Screen.MonitorCount))

获取监视器详细信息

Screen.Monitors[i].Left (integer)
                  .Top (integer)
                  .Width (integer)
                  .Height (integer)
                  .BoundsRect (TRect)
                  .WorkareaRect (TRect)
                  .Primary (boolean)

其中 i 是监视器的索引,即 i = 0, 1, ..., Screen.MonitorCount - 1

因此,例如,要使表单占据整个第 i 个监视器,请使用

BoundsRect := Screen.Monitors[i].BoundsRect; // or you could make the rect smaller
WindowState := wsMaximized; // possibly

【讨论】:

  • 当然,对于非常简单的情况,设置DefaultMonitor 属性可能就足够了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-04-27
  • 1970-01-01
  • 2018-12-03
  • 2016-11-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多