UIGifAnim.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef GifAnimUI_h__
  2. #define GifAnimUI_h__
  3. #pragma once
  4. namespace DuiLib
  5. {
  6. class UILIB_API CGifAnimUI : public CControlUI
  7. {
  8. enum
  9. {
  10. EVENT_TIEM_ID = 100,
  11. };
  12. DECLARE_DUICONTROL(CGifAnimUI)
  13. public:
  14. CGifAnimUI(void);
  15. ~CGifAnimUI(void);
  16. LPCTSTR GetClass() const;
  17. LPVOID GetInterface(LPCTSTR pstrName);
  18. void DoInit();
  19. bool DoPaint(HDC hDC, const RECT& rcPaint, CControlUI* pStopControl);
  20. void DoEvent(TEventUI& event);
  21. void SetVisible(bool bVisible = true );
  22. void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  23. void SetBkImage(LPCTSTR pStrImage);
  24. LPCTSTR GetBkImage();
  25. void SetAutoPlay(bool bIsAuto = true );
  26. bool IsAutoPlay() const;
  27. void SetAutoSize(bool bIsAuto = true );
  28. bool IsAutoSize() const;
  29. void PlayGif();
  30. void PauseGif();
  31. void StopGif();
  32. private:
  33. void InitGifImage();
  34. void DeleteGif();
  35. void OnTimer( UINT_PTR idEvent );
  36. void DrawFrame( HDC hDC ); // 绘制GIF每帧
  37. private:
  38. Gdiplus::Image *m_pGifImage;
  39. UINT m_nFrameCount; // gif图片总帧数
  40. UINT m_nFramePosition; // 当前放到第几帧
  41. Gdiplus::PropertyItem* m_pPropertyItem; // 帧与帧之间间隔时间
  42. CDuiString m_sBkImage;
  43. bool m_bIsAutoPlay; // 是否自动播放gif
  44. bool m_bIsAutoSize; // 是否自动根据图片设置大小
  45. bool m_bIsPlaying;
  46. };
  47. }
  48. #endif // GifAnimUI_h__