开发者

Delphi TColorDialog Opens behind a stayOnTop form

开发者 https://www.devze.com 2023-02-24 23:24 出处:网络
I have a main form (form1) that calls form2 which is a stayontop form.form2 calls a modal form (form开发者_运维问答3) which is also a stayontop form.when form3 modal form calls the colordialog, the co

I have a main form (form1) that calls form2 which is a stayontop form. form2 calls a modal form (form开发者_运维问答3) 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).

0

精彩评论

暂无评论...
验证码 换一张
取 消