用GifImage控件在Image1中放gif图片,运行后图片总是一闪一闪的.直接运行gif却是正常的.请教下为什么会这样,怎么解决这个问题?

解决方案 »

  1.   

      Self.DoubleBuffered := True;
      

  2.   

    procedure   TImage.PictureChanged(Sender:   TObject); 
    var 
        G:   TGraphic; 
    begin 
        if   AutoSize   and   (Picture.Width   >   0)   and   (Picture.Height   >   0)   then 
    SetBounds(Left,   Top,   Picture.Width,   Picture.Height); 
        G   :=   Picture.Graphic; 
        if   G   <>   nil   then 
        begin 
    if   not   ((G   is   TMetaFile)   or   (G   is   TIcon))   then 
        G.Transparent   :=   FTransparent; 
    if   (not   G.Transparent)   and   Stretch   and   not   Proportional   then 
        ControlStyle   :=   ControlStyle   +   [csOpaque] 
    else     //   picture   might   not   cover   entire   clientrect 
        ControlStyle   :=   ControlStyle   -   [csOpaque]; 
    if   DoPaletteChange   and   FDrawing   then   Update; 
        end 
        else   ControlStyle   :=   ControlStyle   -   [csOpaque]; 
        if   not   FDrawing   then   Invalidate; 
    end; //从上面的VCL代码中可分析出哪些属性影响了透明效果,也就是Transparent:=False,Proportional=False时,不透明,也就不闪