Delphi TColorDialog Opens behind a stayOnTop form

倾然丶 夕夏残阳落幕 提交于 2019-12-11 06:04:09

问题


I have a main form (form1) that calls form2 which is a stayontop form. form2 calls a modal form (form3) which is also a stayontop form. when form3 modal form calls the colordialog, the color dialog opens behind form3.

What to set to open color dialog in front of form3?

I'm using D2009

thanks


回答1:


Delphi (around D2007) introduced an overloaded Execute methods for all of the standard dialogs that accept a parent window handle as a parameter. 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. 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).



来源:https://stackoverflow.com/questions/5660468/delphi-tcolordialog-opens-behind-a-stayontop-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!