简体   繁体   中英

Delphi TColorDialog Opens behind a stayOnTop form

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

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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