不行啊,它只对第一个窗体有效啊,我是要在第二个窗体上来实现了,第二个窗体通过:form2.show来调用了,谢谢

解决方案 »

  1.   

    你可以将窗口的FormStyle属性设置为第三个,好象是fsontop吧,你自己看看
      

  2.   


      formstyle:=fsStayOnTop
    就可以更改窗体一直在最前面,一定可以的
     
     
      

  3.   

    form2.FormStyle:=fsStayOnTop;或 Form2.ShowModal
      

  4.   

    要不你把子窗体显示时用 form2.showmodel 吧
      

  5.   

    可以使用delphi中的fromstyle属性设为:fsStayOnTop
    或windows api函数:setwindowpos
      

  6.   

    form2.FormStyle:=fsStayOnTop;或 Form2.ShowModal
      

  7.   

    在form1中用来显示form2的控件中加入
    form2.showModalform2.formstyle := fsStayOntop;
      

  8.   

    在欲显示的窗体(Form2)中写:
    protected//Type
        procedure CreateParams( var Params: TCreateParams );override;procedure TForm2.CreateParams( var Params: TCreateParams );//implementation
    begin
      inherited CreateParams( Params );
      with Params do
      begin
        Style := Style or ws_Overlapped;
        WndParent := Form1.Handle;    //父窗体为form1
      end;
    end;然后在主窗体(Form1)中写:
    Form2.Show;
      

  9.   

    重栽createparams函数。这样:unit Unit2;interfaceuses
      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;