当用户单击X表单上的按钮时,如何隐藏它而不是关闭它?
我曾尝试this.hide()在FormClosing,但它仍然关闭窗体.
在Delphi应用程序中,当您将鼠标悬停在边框图标上时,例如:
它行为不正确:
与行为正确的应用程序进行比较:
怎么修?
编辑 - Delphi 7也失败了:
在Delphi 5中:
在Delphi 4中:
我假设(即害怕)它是由ThemeServices引擎引起的; 他们可能认为不尊重用户的偏好很酷.但看起来它更基本.
Skype也失败了; 也用Delphi编写:
我终于找到了为什么它在我使用的每台Windows 10机器上都失败了; 但不适合所有人.高dpi.
将dpi设置为97(101%)或更高.
我有两种"无模式"形式:
你可以看到:
从这种无模式的形式,我想展示一个模态:
的模态形式被构造为:
var
frmExchangeConfirm: TfrmExchangeConfirm;
begin
frmExchangeConfirm := TfrmExchangeConfirm.Create(Application);
try
//Setting popupMode and popupParent still makes the MainForm disabled
// frmExchangeConfirm.PopupMode := pmExplicit;
// frmExchangeConfirm.PopupParent := Self; //owned by us
frmExchangeConfirm.OwnerForm := Self; //tell the form which owner to use
frmExchangeConfirm.ShowModal;
finally
frmExchangeConfirm.Free;
end;
Run Code Online (Sandbox Code Playgroud)
模态表单被告知通过新OwnerForm属性使用哪个所有者:
protected
procedure SetOwnerForm(const Value: TForm);
public
property OwnerForm: TForm read GetOwnerForm write SetOwnerForm;
end;
Run Code Online (Sandbox Code Playgroud)
这迫使手柄娱乐:
procedure TfrmExchangeConfirm.SetOwnerForm(const Value: …Run Code Online (Sandbox Code Playgroud)