mirror of
https://github.com/duilib/duilib.git
synced 2026-10-17 06:01:08 +08:00
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
#ifndef GifAnimUI_h__
|
|
#define GifAnimUI_h__
|
|
|
|
#pragma once
|
|
|
|
namespace DuiLib
|
|
{
|
|
class CControl;
|
|
|
|
#define EVENT_TIEM_ID 100
|
|
|
|
class DUILIB_API CGifAnimUI : public CControlUI
|
|
{
|
|
public:
|
|
CGifAnimUI(void);
|
|
~CGifAnimUI(void);
|
|
|
|
LPCTSTR GetClass() const;
|
|
LPVOID GetInterface(LPCTSTR pstrName);
|
|
void DoInit() override;
|
|
bool DoPaint(HDC hDC, const RECT& rcPaint, CControlUI* pStopControl);
|
|
void DoEvent(TEventUI& event);
|
|
void SetVisible(bool bVisible = true );
|
|
void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
|
|
void SetBkImage(LPCTSTR pStrImage);
|
|
LPCTSTR GetBkImage();
|
|
|
|
void SetAutoPlay(bool bIsAuto = true );
|
|
bool IsAutoPlay() const;
|
|
void SetAutoSize(bool bIsAuto = true );
|
|
bool IsAutoSize() const;
|
|
void PlayGif();
|
|
void PauseGif();
|
|
void StopGif();
|
|
|
|
private:
|
|
void InitGifImage();
|
|
void DeleteGif();
|
|
void OnTimer( UINT_PTR idEvent );
|
|
void DrawFrame( HDC hDC ); // 绘制GIF每帧
|
|
Gdiplus::Image* LoadGifFromFile(LPCTSTR pstrGifPath);
|
|
Gdiplus::Image* LoadGifFromMemory( LPVOID pBuf,size_t dwSize );
|
|
private:
|
|
Gdiplus::Image *m_pGifImage;
|
|
UINT m_nFrameCount; // gif图片总帧数
|
|
UINT m_nFramePosition; // 当前放到第几帧
|
|
Gdiplus::PropertyItem* m_pPropertyItem; // 帧与帧之间间隔时间
|
|
|
|
CDuiString m_sBkImage;
|
|
bool m_bIsAutoPlay; // 是否自动播放gif
|
|
bool m_bIsAutoSize; // 是否自动根据图片设置大小
|
|
bool m_bIsPlaying;
|
|
IStream* m_pStream;
|
|
};
|
|
}
|
|
|
|
#endif // GifAnimUI_h__
|