如何强制Showmodal在特定显示器上打开窗体?

hmtdttj4  于 2022-09-21  发布在  其他
关注(0)|答案(1)|浏览(129)

我有两个监视器,其中主(左,大)监视器是Screen.Monitors[0],次(右,小)监视器是Screen.Monitors[1]

因此,在西雅图的Delphi 10中,我写道:

  1. var M: Integer;
  2. M := Self.Monitor.MonitorNum; // -> 1 (main app is located on secondary monitor)
  3. aFullScreenForm := TFullScreenForm.Create(SELF);
  4. aFullScreenForm.SetBounds(Screen.Monitors[M].Left, Screen.Monitors[M].Top, Screen.Monitors[M].Width, Screen.Monitors[M].Height);
  5. aFullScreenForm.ShowModal;
  6. aFullScreenForm.Free;

但是,表aFullScreenForm总是在主显示器上全屏显示,而不是在辅助显示器上全屏显示!

那么,如何强制在辅助监视器(或主应用程序窗体所在的同一监视器)上打开表单aFullScreenForm呢?

dwthyt8l

dwthyt8l1#

在主窗体的同一屏幕上显示情态表格

模式表属性

  1. Position := poOwnerFormCenter;
  2. Align := alNone;
  3. //if You wanna the modal form on max size
  4. WindowState := wsMaximized;

论形态情态OnActivate事件

  1. Left := mainForm.Left;
  2. Top := mainForm.Top;

相关问题