【发布时间】:2010-09-18 14:43:05
【问题描述】:
我有两台显示器,一台显示器连接到我的笔记本电脑。如何选择将显示我的应用程序的监视器?
另外,我如何检测我连接了多少台显示器以便我可以选择一台?
谢谢
【问题讨论】:
-
可能的重复和相关问题:stackoverflow.com/questions/206400
我有两台显示器,一台显示器连接到我的笔记本电脑。如何选择将显示我的应用程序的监视器?
另外,我如何检测我连接了多少台显示器以便我可以选择一台?
谢谢
【问题讨论】:
使用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 属性可能就足够了。