Exemplo n.º 1
0
//绘画头像
void CExpression::DrawItem(CDC * pDC, int iXPos, int iYPos, bool bSelectec)
{
	CExpressionItem * pExpressionItem=GetExpressItem(iYPos*m_wMaxRow+iXPos);
	int nFaceIndex = iYPos*m_wMaxRow+iXPos;
	if (pExpressionItem!=NULL)
	{
		if (bSelectec)
		{
			pDC->FillSolidRect(iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE/2,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE/2,
				EP_PIC_WHIDE+PIC_SPACE,EP_PIC_HIGHT+PIC_SPACE,RGB(255,255,255));
			pDC->Draw3dRect(iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE/2,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE/2,
				EP_PIC_WHIDE+PIC_SPACE,EP_PIC_HIGHT+PIC_SPACE,RGB(28,57,208),RGB(28,57,208));
		}
		else
		{
			pDC->FillSolidRect(iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE/2,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE/2,
				EP_PIC_WHIDE+PIC_SPACE,EP_PIC_HIGHT+PIC_SPACE,RGB(255,255,255));

		}

		//装载图片
		TCHAR szFileName[MAX_PATH]=TEXT("");
		_snprintf(szFileName,sizeof(szFileName),TEXT("%s\\Face\\%d.gif"),m_szPath, nFaceIndex);
		CImage ImageFace;
		if ( SUCCEEDED(ImageFace.Load(szFileName) ) )
		{
			//背景判断
			COLORREF rfColor = ImageFace.GetPixel(0,0);
			TransparentBlt(pDC->GetSafeHdc(), iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE, 
				EP_PIC_WHIDE, EP_PIC_HIGHT, ImageFace.GetDC(), 0, 0, EP_PIC_WHIDE, EP_PIC_HIGHT, rfColor);
			ImageFace.ReleaseDC();
		}
	}
	return;
}
Exemplo n.º 2
0
//绘画头像
void CExpression::DrawItem(CDC * pDC, int iXPos, int iYPos, bool bSelectec)
{
	CExpressionItem * pExpressionItem=GetExpressItem(iYPos*m_wMaxRow+iXPos);
	if (pExpressionItem!=NULL)
	{
		if (bSelectec)
		{
			pDC->FillSolidRect(iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE/2,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE/2,
				EP_PIC_WHIDE+PIC_SPACE,EP_PIC_HIGHT+PIC_SPACE,RGB(255,255,255));
			pDC->Draw3dRect(iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE/2,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE/2,
				EP_PIC_WHIDE+PIC_SPACE,EP_PIC_HIGHT+PIC_SPACE,RGB(28,57,208),RGB(28,57,208));
		}
		else
		{
			pDC->FillSolidRect(iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE/2,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE/2,
				EP_PIC_WHIDE+PIC_SPACE,EP_PIC_HIGHT+PIC_SPACE,RGB(255,255,255));
		}
		CDC MemDC;
		MemDC.CreateCompatibleDC(pDC);
		MemDC.SelectObject(pExpressionItem->m_Image);
		pDC->BitBlt(iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE,EP_PIC_WHIDE,EP_PIC_HIGHT,
			&MemDC,0,0,SRCCOPY);
	}
	return;
}
Exemplo n.º 3
0
//绘画头像
void CExpression::DrawItem(CDC * pDC, int iXPos, int iYPos, bool bSelectec)
{
	CExpressionItem * pExpressionItem=GetExpressItem(iYPos*m_wMaxRow+iXPos);
	if (pExpressionItem!=NULL)
	{
		if (bSelectec)
		{
			pDC->FillSolidRect(iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE/2,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE/2,
				EP_PIC_WHIDE+PIC_SPACE,EP_PIC_HIGHT+PIC_SPACE,RGB(255,255,255));
			pDC->Draw3dRect(iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE/2,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE/2,
				EP_PIC_WHIDE+PIC_SPACE,EP_PIC_HIGHT+PIC_SPACE,RGB(28,57,208),RGB(28,57,208));
		}
		else
		{
			pDC->FillSolidRect(iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE/2,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE/2,
				EP_PIC_WHIDE+PIC_SPACE,EP_PIC_HIGHT+PIC_SPACE,RGB(255,255,255));
		
		}

		//加载资源
		CSkinImage SkinImage;
		SkinImage.LoadFromResource(GetModuleHandle(CLIENT_SHARE_DLL_NAME),pExpressionItem->m_uImageID);
		SkinImage.AlphaDrawImage(pDC,iXPos*(EP_PIC_WHIDE+PIC_SPACE)+PIC_SPACE,iYPos*(EP_PIC_HIGHT+PIC_SPACE)+PIC_SPACE,RGB(255,0,255));
	}
	return;
}
Exemplo n.º 4
0
//鼠标移动消息
void CExpression::OnMouseMove(UINT nFlags, CPoint point)
{
	WORD wSelectIndex=HitItemTest(point);
	if (wSelectIndex!=m_wSelectIndex)
	{
		CDC * pDC=GetDC();
		if (m_wSelectIndex!=MAX_EXPRESS_ITEM)
		{
			//清除旧选择
			DrawItem(pDC,m_wSelectIndex%m_wMaxRow,m_wSelectIndex/m_wMaxRow,false);
			m_wSelectIndex=MAX_EXPRESS_ITEM;
		}
		m_wSelectIndex=wSelectIndex;
		if (m_wSelectIndex!=MAX_EXPRESS_ITEM)
		{
			//显示新选择
			CExpressionItem * pExpressionItem=GetExpressItem(m_wSelectIndex);
			if (pExpressionItem!=NULL) DrawItem(pDC,m_wSelectIndex%m_wMaxRow,m_wSelectIndex/m_wMaxRow,true);
		}
		ReleaseDC(pDC);
	}

	return;
}