AnimateWindow这个API对twebbrowser等一起控件不起作用,求解决的方法?
以下方法试过,不管用.
{
原因很简单,但是解决方法很麻烦。 
        MSDN文档说窗体中的控件的windows程序必须处理WM_PRINT或WM_PRINTCLIENT消息,使它们与AnimateWindow   API函数一起使用。这些消息当Windows需要在屏幕以外的显示环境(如打印机,在这里使屏幕外位图)绘图时被使用。该文档说普通控件和对话框的窗口程序已经处理了这些消息。         这就解释了一些控件绘图正常:例如TButton,   TCheckBox和TRadioButton它们拥有和管理底下的按钮控件,这样它们能正确的处理消息。         绘图有错误的控件是一种中间类型,它们拥有按钮控件但是一些部分使应用Dephi的TCanvas而不是Windows   GDI绘制的,如TEdit,   TRichEdit和其他这样的控件。           不可见的控件是完全不拥有普通控件的那些,它们都是TGraphic的后代,如TShape和TBevel。这些控件决不会画出来,因为它们接收不到需要的消息。         但是,对从TWinControl衍生出来的Delphi对象,你可以这样从中间截取和处理WM_PRINTCLIENT消息: unit   TestGroupBox;   interface   uses   
    Windows,   Messages,   SysUtils,   Classes,   Graphics,   Controls,   Forms,   Dialogs,   
    StdCtrls;   type   
    TTestGroupBox   =   class(TGroupBox)   
    private   
        {   Private   declarations   }   
    protected   
        {   Protected   declarations   }   
        procedure   WMPrintClient(var   Msg:   TMessage);   message   WM_PRINTCLIENT;       public   
        {   Public   declarations   }   
    published   
        {   Published   declarations   }   
    end;   procedure   Register;   implementation   procedure   Register;   
begin   
    RegisterComponents( ' 'Test ' ',   [TTestGroupBox]);   
end;   {   TTestGroupBox   }   procedure   TTestGroupBox.WMPrintClient(var   Msg:   TMessage);   
begin   
          PaintTo(HDC(Msg.WParam),   0,   0);   
end;   end.           这是一个从TGroupBox派生出来的例子组件。由于TGroupBox拥有的不是一个普通窗口控件,WM_PRINTCLIENT没有被处理。程序添加消息处理函数并在一个不同的显示环境中使用PaintTo方法,这些都是直接了当的。         现在是麻烦的部分了:你窗体的每一个控件都必须这样修改,而且你必须修改你所有的对象才能安全使用AnimateWindow   API函数。 
}

解决方案 »

  1.   

    管用的效果不好.哪还谈得上动画效果,动画时看不到东西,完了才刷新显示出来.真邪了门了.
    procedure   TFrmBase.FormShow(Sender:   TObject);     procedure   RefreshControl(Control:   TControl);                             ///可能包含子控件,也要刷新 
        var 
            i                               :   integer; 
        begin 
            Control.Invalidate; 
            if   Control   is   TWinControl   then 
                for   i   :=   0   to   TWinControl(Control).ControlCount   -   1   do 
                    RefreshControl(TWinControl(Control).Controls[i]); 
        end; begin 
        AnimateWindow(Handle,   200,   AW_SLIDE   +   AW_CENTER);///动画显示 
        RefreshControl(Self);   ///使用动画之后,必须Refresh,否则控件看不到! 
        SetActiveWindow(Handle);   ///激活窗口 
    end;