简体   繁体   English

Delphi TColorDialog在stayOnTop表单后面打开

[英]Delphi TColorDialog Opens behind a stayOnTop form

I have a main form (form1) that calls form2 which is a stayontop form. 我有一个主窗体(form1)调用form2,这是一个Stayontop窗体。 form2 calls a modal form (form3) which is also a stayontop form. form2调用模态形式(form3),它也是一个保留形式。 when form3 modal form calls the colordialog, the color dialog opens behind form3. 当form3模态表单调用colordialog时,将在form3后面打开颜色对话框。

What to set to open color dialog in front of form3? 要设置什么以在form3前面打开颜色对话框?

I'm using D2009 我正在使用D2009

thanks 谢谢

Delphi (around D2007) introduced an overloaded Execute methods for all of the standard dialogs that accept a parent window handle as a parameter. Delphi(大约D2007)为所有接受父窗口句柄作为参数的标准对话框引入了重载的Execute方法。 Change your call to display the dialog: 更改您的呼叫以显示对话框:

if ColorDialog1.Execute(Handle) then
begin
  // Do whatever
end;

Handle in this case would be the window handle of the stay on top form that's displaying the TColorDialog . 在这种情况下, Handle将是显示TColorDialog顶部窗体的窗口句柄。 If you're executing the dialog from another window, you'll need to pass the stay on top form's handle instead. 如果要从另一个窗口执行对话框,则需要将停留在顶部窗体的句柄上传递。

The documentation is here (XE version, but it still applies to D2009). 文档在此处 (XE版本,但仍适用于D2009)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM