Delphi 如何选择要打开应用程序的监视器?

Delphi 如何选择要打开应用程序的监视器?,delphi,multiple-monitors,Delphi,Multiple Monitors,可能重复: 我有两个显示器,一个连接到笔记本电脑的显示器。如何选择应用程序将显示的监视器 另外,我如何检测连接了多少个监视器,以便选择一个 谢谢使用屏幕对象 获取监视器计数 ShowMessage(IntToStr(Screen.MonitorCount)) 获取监视器详细信息 Screen.Monitors[i].Left (integer) .Top (integer) .Width (integer)

可能重复:

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

另外,我如何检测连接了多少个监视器,以便选择一个


谢谢

使用
屏幕
对象

获取监视器计数

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
属性可能就足够了。可能存在重复和相关问题: