我想在状态中播放一个GIF格式的动画 
要怎么实现啊 
大家指导指导啊 谢谢ing

解决方案 »

  1.   

    http://www.vckbase.com/code/findcode.asp
      

  2.   

    有一个animalctrl控件 只能播放avi格式的 
    你说的是哪个控件呢
      

  3.   

    http://www.vchome.net/tech/graphics/graph24.htm
      

  4.   

    http://www.vckbase.com/code/downcode.asp?id=2074 实例源代码
      

  5.   

    用CPictureExhttp://www.codeproject.com/KB/graphics/pictureex.aspx
      

  6.   

    怎样实现啊 是GDI+吗
    在线等
    谢谢
      

  7.   


    class CGif : public Image
    {
    public:
    virtual void AddRef(void);
    virtual void Release(void);
            //这里会返回下一帧和当前帧和时间间隔  用来在画的时候控制  anFramePosition表示当前要画第一帧
    virtual long Draw(HDC hdc, const RECT& arcRect, unsigned int& anFramePosition);
    public:
    CGif(const wchar_t* filename, bool useEmbeddedColorManagement = false);
    bool IsAnimatedGIF() { return m_nFrameCount > 1;}//这里判断是不是Gif
    private:
    void Initialize();
    bool TestForAnimatedGIF();private:
    long mulRef;
    bool m_bIsInitialized;
    PropertyItem* m_pPropertyItem;
    unsigned int m_nFrameCount;
    unsigned int m_nFramePosition;
    };CGif::CGif(const wchar_t* filename, bool useEmbeddedColorManagement)
    :Image(filename, useEmbeddedColorManagement)
    {
    mulRef = 0; AddRef();
    Initialize(); m_bIsInitialized = true; TestForAnimatedGIF();
    }void CGif::Initialize()
    {
    m_nFrameCount = 0;
    m_bIsInitialized = false;
    m_pPropertyItem = NULL;
    m_nFramePosition = 0;
    }bool CGif::TestForAnimatedGIF()
    {
    unsigned int count = 0;
    count = GetFrameDimensionsCount();
    GUID* pDimensionIDs = new GUID[count]; // Get the list of frame dimensions from the Image object.
    GetFrameDimensionsList(pDimensionIDs, count); // Get the number of frames in the first dimension.
    m_nFrameCount = GetFrameCount(&pDimensionIDs[0]); // Assume that the image has a property item of type PropertyItemEquipMake.
    // Get the size of that property item.
    int nSize = GetPropertyItemSize(PropertyTagFrameDelay); // Allocate a buffer to receive the property item.
    m_pPropertyItem = (PropertyItem*) malloc(nSize); GetPropertyItem(PropertyTagFrameDelay, nSize, m_pPropertyItem); delete [] pDimensionIDs; return m_nFrameCount > 1;
    }void CGif::AddRef(void)
    {
    InterlockedIncrement(&mulRef);
    }void CGif::Release(void)
    {
    InterlockedDecrement(&mulRef);
    if(mulRef == 0)
    {
    delete this;
    }
    }long CGif::Draw(HDC hdc, const RECT& arcRect, unsigned int& anFramePosition)
    { GUID   pageGuid = FrameDimensionTime; if (hdc)
    {
    Graphics graphics(hdc);
    graphics.DrawImage(this, arcRect.left, arcRect.top, arcRect.right - arcRect.left, arcRect.bottom - arcRect.top);
    } SelectActiveFrame(&pageGuid, anFramePosition++); if (anFramePosition == m_nFrameCount)
    anFramePosition = 0; long lPause = ((long*)m_pPropertyItem->value)[anFramePosition] * 10; return lPause;
    }
      

  8.   

    GIF 动画的问题似乎问的人比较多啊,多数都用 CPictureEx 或 CxImage 类我做的个小玩意儿,支持 GIF 动画,不过不是用这两个类,自己写的,核心就是起线程画每一帧:
    http://blog.csdn.net/DavidHsing/archive/2009/03/24/4020197.aspx
      

  9.   

    使用Image类时怎么会有很多错误:
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(25) : error C2059: 语法错误 : “字符串”
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(26) : error C2091: 函数返回函数
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(26) : error C2802: 静态成员“operator new”没有形参
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(26) : error C2333: “Gdiplus::GdiplusBase::operator new”: 函数声明中有错误;跳过函数体
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(33) : error C2059: 语法错误 : “字符串”
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(33) : error C2090: 函数返回数组
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(35) : error C2059: 语法错误 : “return”
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(35) : error C2238: 意外的标记位于“;”之前
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(37) : error C2143: 语法错误 : 缺少“;”(在“}”的前面)
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(23) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(175) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(245) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(308) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(373) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(638) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(706) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusimageattributes.h(39) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusmatrix.h(16) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbrush.h(25) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdipluspen.h(22) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusstringformat.h(19) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdipluspath.h(19) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdipluspath.h(903) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusgraphics.h(19) : error C2504: “GdiplusBase”: 未定义基类
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplus.h(77) : error C2059: 语法错误 : “}”
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplus.h(77) : error C2143: 语法错误 : 缺少“;”(在“}”的前面)
    1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplus.h(77) : error C2059: 语法错误 : “}”
    1>f:\设计盘\mfctest\mfctest\mfctestdlg.cpp(142) : error C2664: “LoadIconA”: 不能将参数 2 从“int”转换为“LPCSTR”
    1>        从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换
      

  10.   

    这个貌似gdi+有时候有这个问题  我也不知道原因  不过你可以在使用new的地方加域:: 好像可以解决 
      

  11.   

    GDI+本身没直接安装,需要将某些文件copy到指定文件夹