Delphi 10.2.2弹窗位置
Delphi 10.2.2 popup position
procedure TForm1.Button1Click(Sender: TObject);
begin
Popup1.Position.X := (Self.Width + Popup1.Width) / 2;
Popup1.Position.Y := (Self.Height + Popup1.Height) / 2;
Popup1.Popup(False);
end;
我正在尝试将弹出窗口置于移动设备的中央。即使在代码中设置了 Position 之后,弹出窗口仍然出现在用户点击按钮的任何地方。
如何让弹出窗口显示在屏幕中央?或者我想让它出现在什么地方?
文档让我感到困惑,但它清楚地表明设置 TPopup 的位置不会有任何作用。
我最终在设计器中将 TPopup 的位置更改为居中。然后在表单的 FormResize() 中我添加了...
Popup1.VerticalOffset := Self.Height / 2;
Popup1.HorizontalOffset := Self.Width / 2;
这适用于移动设备。
procedure TForm1.Button1Click(Sender: TObject);
begin
Popup1.Position.X := (Self.Width + Popup1.Width) / 2;
Popup1.Position.Y := (Self.Height + Popup1.Height) / 2;
Popup1.Popup(False);
end;
我正在尝试将弹出窗口置于移动设备的中央。即使在代码中设置了 Position 之后,弹出窗口仍然出现在用户点击按钮的任何地方。
如何让弹出窗口显示在屏幕中央?或者我想让它出现在什么地方?
文档让我感到困惑,但它清楚地表明设置 TPopup 的位置不会有任何作用。
我最终在设计器中将 TPopup 的位置更改为居中。然后在表单的 FormResize() 中我添加了...
Popup1.VerticalOffset := Self.Height / 2;
Popup1.HorizontalOffset := Self.Width / 2;
这适用于移动设备。