在Delphi中使子窗口也能始终保持在最前的方法

重栽createparams函数。这样:

unit   Unit2;

interface

uses
    Windows,   Messages,   SysUtils,   Variants,   Classes,   Graphics,   Controls,   Forms,
    Dialogs;

type
    TForm2   =   class(TForm)
    private
        {   Private   declarations   }
        procedure   CreateParams(var   Params:   TCreateParams);   override;
    public
        {   Public   declarations   }
    end;

var
    Form2:   TForm2;

implementation

{$R   *.dfm}

procedure   TForm2.CreateParams(var   Params:   TCreateParams);
begin
    inherited;
    Params.WndParent:=   0;
end;

end.

设置form2.FormStyle:=fsStayOnTop;


发表评论

电子邮件地址不会被公开。 必填项已用*标注

− 3 = 3