我的应用程序中的窗口弹出屏幕边缘,这当然是个问题,因为一些窗口是模态的,不能关闭(你甚至不知道它们在那里)。
我使用TurboPower Orpheus组件来记住每个表单的位置和大小,在表单再次显示时恢复它。它将大小和位置保存在INI文件中。
有什么办法可以防止窗口从屏幕边缘弹出?
我使用TurboPower Orpheus组件来记住每个表单的位置和大小,在表单再次显示时恢复它。它将大小和位置保存在INI文件中。
有什么办法可以防止窗口从屏幕边缘弹出?
Monitors
数组(以及它们各自的坐标)是唯一重要的。除此之外,我同意你的回答,加一! - mghie您可能需要查看它们的DefaultMonitor
属性,并阅读来自TCustomForm.SetWindowToMonitor
的代码,以了解如何处理相对于Screen.Monitors
的定位。
Use DefaultMonitor to associate a form with a particular monitor in a multi-monitor application. The following table lists the possible values:
Value Meaning
dmDesktop No attempt is made to position the form on a specific monitor.
dmPrimary The form is positioned on the first monitor listed in the global screen object's Monitors property.
dmMainForm The form appears on the same monitor as the application's main form.
dmActiveForm The form appears on the same monitor as the currently active form.
Note: DefaultMonitor has no effect if the application does not have a main form.