2

Delphi 10.4 FMX desktop project

I create a form and set its FormStyle to StayOnTop. The window works as expected, staying on top of other windows in the project.

But when the app goes into the background, this form stays on top of all other apps. How do get this window to go into the background like all the other windows in the project?

4

1 回答 1

3

您是否尝试在 **MainForm** 上进行 OnActivate 和 OnDeactivate ?:
procedure TForm1.FormActivate(Sender: TObject);
begin
  if Assigned(Form2) then
    Form2.FormStyle := TFormStyle.StayOnTop;
end;

procedure TForm1.FormDeactivate(Sender: TObject);
begin
  if Assigned(Form2) then
    Form2.FormStyle := TFormStyle.Normal;
end;
于 2020-11-27T14:50:38.560 回答