Click here to Skip to main content
15,885,985 members
Articles / Desktop Programming / MFC

Play GIF using GDI+

Rate me:
Please Sign up or sign in to vote.
3.34/5 (22 votes)
1 Sep 2011CPOL 77.8K   3.9K   59  
A new choice for playing GIF using GDI+
#ifndef __LINA_BOT_GIF_CONTROL_H__

#include <vector>

namespace LinaBot
{
	namespace CommonCtrl
	{

		//����ؼ�����������ʾ����������
		//�����Ҫ���������Ͱѻ��Ʋ��ֵĴ�����ֲ��CButtonEx��
		class __LINABOT_COMMON_CTRL_API__ CGIFControl : public CStatic
		{
		public:
			CGIFControl();
			virtual ~CGIFControl();

			BOOL Create(CRect& rc,CWnd* parent ,UINT nID);
			void Load(LPCTSTR sFileName);
			void Play();

			void SetBorderRound(Color& c,int iLineWidth = 1);
			void EnableBorder(BOOL bEnable = TRUE);

			void SetURL(LPCTSTR sURL);

		protected:
			virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);

			afx_msg void OnTimer(UINT_PTR nIDEvent);
			afx_msg void OnLButtonDown(UINT nFlags,CPoint point);
			afx_msg void OnMouseMove(UINT nFlags,CPoint point);
			afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
			afx_msg BOOL OnEraseBkgnd(CDC* pDC);

		protected:
			void DrawBorder(Graphics& g);


		protected:
			Image* m_pImage;
			GUID* m_pDimensionIDs;
			UINT m_FrameCount;
			PropertyItem* m_pItem;
			UINT m_iCurrentFrame;

			CString m_URL;

			Color m_cBorder;
			int m_iBorderLineWidth;
			BOOL m_bBorderEnable;

			HCURSOR m_hHandCursor;
			HCURSOR m_hOldCursor;
			BOOL m_bTrackOnce;

		protected:
			DECLARE_MESSAGE_MAP()
		};
	}
}

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions