'Adjust TForm to Current”翻译成中文为'调整当前TForm”,可使用以下代码实现:
procedure AdjustFormToCurrent(form: TForm); var i: Integer; monitor: TMonitor; workArea: TRect; begin for i := 0 to Screen.MonitorCount - 1 do begin monitor := Screen.Monitors[i]; if monitor.MonitorNum = form.Monitor.MonitorNum then begin workArea := monitor.WorkareaRect; form.Left := workArea.Left + (workArea.Width - form.Width) div 2; form.Top := workArea.Top + (workArea.Height - form.Height) div 2; Break; end; end; end;
调用示例:
AdjustFormToCurrent(Form1);
上一篇:AdjustText库不能调整matplotlib文本标签的位置。
下一篇:AdjustthesettingguidesindentationtokeepittotheUIguidesofFlutterontheVSCode