⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 animate.cpp

📁 net send 消息发送工具
💻 CPP
字号:
// Animate.cpp: implementation of the CAnimate class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "EasyNetSend.h"
#include "Animate.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CAnimate::CAnimate()
{
	m_uIconNum=0;
	m_iCurrIconIndex=0;
}

CAnimate::~CAnimate()
{

}

void CAnimate::Start()
{
	AfxBeginThread(Animate_Thread,this);
}

void CAnimate::Init(HWND hWnd,int xStart,int xEnd,int yStart,int yEnd,int Step, int Cycle)
{
	m_hWnd=hWnd;
	m_xStart=xStart;
	m_xEnd=xEnd;
	m_yStart=yStart;
	m_yEnd=yEnd;
	m_Step=Step;
	m_Cycle=Cycle;
}

UINT CAnimate::Animate_Thread(PVOID p)
{
	CAnimate * pThis=(CAnimate *)p;


	while(1)
	{
		if(pThis->m_xStart>pThis->m_xEnd)
		{
		//	break;
		}

	//	::Sleep(pThis->m_Cycle);
		::Sleep(500);
		HDC hDC=GetWindowDC(pThis->m_hWnd);

//		::DrawIconEx(hDC,pThis->m_xStart,pThis->m_yStart,
//			pThis->m_hIcon[pThis->m_iCurrIconIndex],16,16,0,NULL,DI_NORMAL);

		if(pThis->m_iCurrIconIndex==1)
		{
			pThis->m_iCurrIconIndex=0;
		}
		else
		{
			pThis->m_iCurrIconIndex=1;
		}

		RECT rect;
		::GetWindowRect(pThis->m_hWnd,&rect);
		::SendMessage(pThis->m_hWnd,WM_PAINT,0,0);
		::Sleep(500);
		::DrawIconEx(hDC,pThis->m_xStart,5,
			pThis->m_hIcon[pThis->m_iCurrIconIndex],16,16,0,NULL,DI_NORMAL);

		pThis->m_xStart+=50;
	}
	return 0;
}

void CAnimate::AddIcon(HICON hIcon)
{
	if(m_uIconNum>127)
	{
		return;
	}

	m_hIcon[m_uIconNum++]=hIcon;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -