1、不使用ShowModal,可以使用FormStyle为fsStayOnTop;2、自己社订计时器(内存储关闭窗体代码),缺省为Enable:=False,在OnShow事件中触发为并重新置为False。

解决方案 »

  1.   

    这不是用窗体!而是用相当于showmessage()的对话框,你的方法无法实现
      

  2.   

    在主窗体中设一定时器,时间到了执行下面代码hDialog := FindWindow(PChar(32770), '消息框标题');
    EndDialog(hDialog, IDOK);
      

  3.   

    我觉得Windows的消息框启动时是modal,最好的办法是自已写一个消息框来代替Windows的消息框不就可以,还可以在消息框上有如下字样(还有多少秒就关闭),字样还动态的
      

  4.   

    procedure MyShowMessage(Msg:string;Delay:DWord=2);
    var
      FForm:TForm;
      StartT:DWord;
    begin
      FForm:=TForm.Create(Application);
      With FForm do
      begin
        FormStyle:=fsStayOnTop;
        Font.Name:='宋体';
        Font.Size:=9;
        Width:=100;
        Height:=30;
        Canvas.Font:=Font;
        Position:=poDesktopCenter;
      end;
      SetWindowLong(FForm.Handle,GWL_STYLE,GetWindowLong(FForm.Handle,GWL_STYLE) and (not WS_CAPTION));
      FForm.Height:=FForm.ClientHeight;
      With TLabel.Create(FForm) do
      begin
        Caption:=Msg;
        Parent:=FForm;
      end;
      StartT:=GetTickCount;
      FForm.Show;
      while (GetTickCount-StartT)<Delay*1000 do
        Application.ProcessMessages;
      FForm.Free;
    end;