//输入解释 void CExpressionItem::InitExpressItem(LPCTSTR pszChineseName, LPCTSTR pszTrancelate, UINT uIDResource) { //设置变量 m_uImageID=uIDResource; lstrcpyn(m_szTrancelate,pszTrancelate,CountArray(m_szTrancelate)); lstrcpyn(m_szChineseName,pszChineseName,CountArray(m_szChineseName)); m_wTranceLength=lstrlen(m_szTrancelate); //加载图片 CSkinImage ImageFile; ImageFile.LoadFromResource(GetModuleHandle(CLIENT_SHARE_DLL_NAME),uIDResource); //创建表情 CImage ImageExpression; ASSERT(ImageFile.GetWidth()==EP_PIC_WHIDE); ASSERT(ImageFile.GetHeight()==EP_PIC_HIGHT); ImageExpression.Create(EP_PIC_WHIDE,EP_PIC_HIGHT,32); //绘画表情 CDC * pDC=CDC::FromHandle(ImageExpression.GetDC()); pDC->FillSolidRect(0,0,EP_PIC_WHIDE,EP_PIC_HIGHT,COLOR_CHAR_BK); ImageFile.AlphaDrawImage(pDC,0,0,RGB(255,0,255)); //设置图片 ImageExpression.ReleaseDC(); m_ImageDataObject.SetImage(ImageExpression.Detach()); return; };
//绘画头像 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; }