我的办法是,在FormCreate中用一个循环控制窗体的大小。循环结束后在显示信息。

解决方案 »

  1.   

    这个也行啊?搞错!在执行FormCreate时,窗体是不显示的。还有,在onshow事件中编程也不行的。
      

  2.   

    在你打开新窗体的事件中加入以下代码:(假设新窗体名为form2)
    ……
    var i:integer;
    ……
      form2.show;
      with form2 do
      begin
        width := 1;
        height := 1;
        for i := 1  to 100 do
        begin
         width := i;
         height := i;
         left := 400 - i;
         top := 400 - i;
        end;
      end;
    这段代码执行后,能达到你所说的要求,但由于时间关系,效果没有调好,自己慢慢去调试吧。
    希望各位高手多多指正,提出更好的办法。
      

  3.   

    我的解决方案(经过实践):
    思路:
       在 FormShow的时候,不断的改变 Form 窗口的 区域Rgn来实现类司蚂蚁的效果;
       而不是改变窗口的大小(Height,Width)。
    具体实现:
       1.在 FormShow 的时候,给本 Form 发送一个自定义消息
       const
          WM_MUSIC_NOTIFY = WM_USER + 1004;
       2.在消息处理过程中调用
          mscShowMinToMax( self, 1 );
       3.我的函数集:
    interface
    procedure mscShowMinToMax( frmSender: TForm; iStyle: integer ); overload;
    procedure mscShowMinToMax( frmSender: TForm; MinRc: Trect ); overload;
    { mscStyleToRect 将风格代码转换成Rect }
    function mscStyleToRect( frmSender: TForm; iStyle: integer ): TRect;implementation
    procedure mscShowMinToMax( frmSender: TForm; iStyle: integer );
    var
       MinRc: Trect;
    begin
       MinRc := mscStyleToRect( frmSender, iStyle );
       mscShowMinToMax( frmSender, MinRc );
    end;
    procedure mscShowMinToMax( frmSender: TForm; MinRc: Trect );
    var
       rc: TRect;
       Region: HRGN;
    begin
       with frmSender do
       begin
          rc := MinRc;
          while ( rc.Left > 0 ) or ( rc.Top > 0 )
             or ( rc.Right < Width ) or ( rc.Bottom < Height ) do
          begin
             if rc.Left > 0 then
                Dec( rc.Left );
             if rc.Top > 0 then
                Dec( rc.Top );
             if rc.Right < Width then
                Inc( rc.Right );
             if rc.Bottom < Height then
                Inc( rc.Bottom );
             Region := CreateRectRgn( rc.Left, rc.Top,
                                  rc.Right, rc.Bottom );
             SetWindowRgn( Handle, Region, true );
             DeleteObject( Region );
          end;
       end;
    end;
    function mscStyleToRect( frmSender: TForm; iStyle: integer ): TRect;
    const
       MAX_STYLE = 13; // ( 0 .. 12 )
    begin
       if ( iStyle < 1 ) or ( iStyle > 12 ) then
          iStyle := 1;
       with frmSender do
       begin
          case iStyle of
             0,1:
             begin
                Result.Left := Width div 2 - ( Width div 2 div 8 );
                Result.Top := Height div 2 - ( Height div 2 div 8 );
                Result.Right := Width div 2 + ( Width div 2 div 8 );
                Result.Bottom := Height div 2 + ( Height div 2 div 8 );
             end;
             2: Result := Rect( 0, 0, Width, 0 );            // up to bottom
             3: Result := Rect( 0, 0, 0, Height );           // left to right
             4: Result := Rect( 0, Height, Width, Height );  // bottom to up
             5: Result := Rect( Width, 0, Width, Height );   // right to left
             6: Result := Rect( Width, 0, 0, 0 );
             7: Result := Rect( 0, 0, 0, 0 );                //  left top Corner to right bottom corner
             8: Result := Rect( 0, Height, 0, Height );      // left bottom to right top
             9: Result := Rect( Width, Height, Width, Height ); // right bottom to left top
             10: Result := Rect( 0, Height, 0, 0 );
             11: Result := Rect( Width, Height, 0, Height );
             12: Result := Rect( Width, 0, Width, 0 );
          end;   
       end;
    end;
      

  4.   

    const ADELY=200;
    在窗体的OnShow事件中加入:
    AnimateWindow(handle,ADELAY,aw_center);
      

  5.   

    完全同意 lybt(一艘小船) 的方法 AnimateWindow(handle,500,aw_center); 
      

  6.   

    Musicwind:你的方法我试过了,没有用的。
    倒是用一个API函数有用:
    AnimateWindow(Handle,300,AW_CENTER);
    但这样窗本本身有显示出来而不是显示窗体轮廓。
      

  7.   

    taxi(的士): 我的方法是可以的,但是也是会显示出窗体内容,没有达到你的要求!
    但是,我的代码那么多!艾!太笨了!
    不如人家一个句子搞定!省时间,省精力!
    不过话得说回来,我的方法可以有多种风格显示。
      

  8.   

    补充:
      加一个参数,以免丢失焦点;
      AnimateWindow( Handle, 100, AW_CENTER OR AW_ACTIVATE);
      

  9.   

    那个API在9x下不支持
    我觉得可以把窗体隐藏
    取得窗体相关属性,比如位置、大小等
    然后呢,在将要显示窗体的区域自己画出要做的效果来
    最后显示窗体不知道这样是否可以
      

  10.   

    大家用过SetupBuilder吗?它的主窗体显示的时候就有这种效果。
    明天结束问题。
    那个API WIN98支持。95不支持。
      

  11.   

    2 taxi(的士) :
    AnimateWindow98支持吗?
    我用的是2000,没有98试验
    听说不支持啊
      

  12.   

    速查:WIDdOWS NT:5.0以上版本:Windows:98以上版本;Windows CE:不支持;头文件:Winuser.h;库文件:user32.lib。靠!我看错了!
      

  13.   

    LMD控件组有个控件可以实现,它的例程的Splash就有这个效果