示例#1
0
//鼠标消息
void CCardControl::OnLButtonDown(UINT nFlags, CPoint point)
{
	__super::OnLButtonDown(nFlags, point);

	//状态判断
	if ((m_bPositively==false)||(m_bShowFirst==true)) return;
	if ((point.x>CARD_SPACE)||(m_CardDataArray.GetCount()==0)) return;

	//变量定义
	CClientDC ClientDC(this);
	BYTE bCardData=m_CardDataArray[0];
	CImageHandle HandleCard(&m_ImageCard);
	int nDrawWidth=(m_CardDataArray.GetCount()==1)?CARD_WIDTH:CARD_SPACE;

	//捕获鼠标
	SetCapture();
	m_bCaptureMouse=true;

	//绘画扑克
	int nXPos=GetCardXPos(bCardData);
	int nYPos=GetCardYPos(bCardData);
	m_ImageCard.AlphaDrawImage(&ClientDC,0,0,nDrawWidth,CARD_HEIGHT,nXPos,nYPos,RGB(255,0,255));

	return;
}
示例#2
0
//重画函数
void CShowHandCard::OnPaint()
{
	CPaintDC dc(this);
	if (m_bCardCount==0) return;

	//加载位图
	CAFCImageHandle CardHandle(&m_CardPic);
	CAFCImageHandle BackHandle(&m_BackPic);

	//绘画扑克
	if ((m_bShowFirst==true)&&(m_CardArray[0]!=0))
	{
		//绘画扑克
		CardHandle.BitBlt(dc,0,0,(m_bCardCount==1)?m_iCardWidth:m_iCardHSpace,m_iCardHight,
			GetCardXPos(m_CardArray[0])*m_iCardWidth,GetCardYPos(m_CardArray[0])*m_iCardHight);
	}
	else 
	{
		//绘画背景
		BackHandle.BitBlt(dc,0,0,(m_bCardCount==1)?m_iCardWidth:m_iCardHSpace,m_iCardHight,0,0);
	}

	for (BYTE i=1;i<m_bCardCount;i++)
	{
		if (m_CardArray[i]==0)
		{
			//绘画背景
			BackHandle.BitBlt(dc,i*m_iCardHSpace,0,(i!=(m_bCardCount-1))?m_iCardHSpace:m_iCardWidth,m_iCardHight,0,0);
		}
		else
		{
			//绘画扑克
			CardHandle.BitBlt(dc,i*m_iCardHSpace,0,(i!=(m_bCardCount-1))?m_iCardHSpace:m_iCardWidth,m_iCardHight,
				GetCardXPos(m_CardArray[i])*m_iCardWidth,GetCardYPos(m_CardArray[i])*m_iCardHight);
		}
	}
	return;
}
示例#3
0
//重画函数
void CSmallGameCard::OnPaint()
{
	CPaintDC dc(this);
	if (m_bCardCount==0) return;

	//建立缓冲
	//双缓冲画扑克
	CDC BufferDC;
	CSize CardSize;
	CBitmap BufferBmp;
	GetCardSize(CardSize);
	BufferDC.CreateCompatibleDC(&dc);
	BufferBmp.CreateCompatibleBitmap(&dc,CardSize.cx,CardSize.cy);
	CBitmap * pOldBmp=BufferDC.SelectObject(&BufferBmp);

	//绘画扑克
	int iXPos=0,iYPos=0;
	
	CSkinImage * pActiveHandle=NULL;

	for (BYTE i=0;i<m_bCardCount; i++)
	{
		BYTE bCard=m_CardArray.GetAt(i);
		BYTE bUpCard=m_CardUpArray.GetAt(i);

		if ((m_bShowCard==true)&&(m_CardArray.GetAt(i)!=0))
		{
			if ((bCard==0x4E)||(bCard==0x4F))
			{
				iYPos=0;
				iXPos=(bCard-0x4D)*m_iCardWidth;
				pActiveHandle=&m_CardPic[1];
			}
			else
			{
				pActiveHandle=&m_CardPic[0];
				iXPos=GetCardXPos(bCard)*m_iCardWidth;
				iYPos=GetCardYPos(bCard)*m_iCardHight;
			}
			if(m_bShowTen)
			{
				iYPos=0;
				if(bCard<0x40) iXPos=(bCard>>4)*m_iCardWidth;
				else iXPos=(bCard-0x4E+4)*m_iCardWidth;
				pActiveHandle=&m_CardPic[0];
			}

		}
		else
		{
示例#4
0
//右键消息
void CShowHandCard::OnLButtonDown(UINT nFlags, CPoint point)
{
	__super::OnLButtonDown(nFlags, point);

	if ((m_bUseMouse==true)&&(m_bShowFirst==false)&&(point.x<(int)m_iCardHSpace)&&(m_bCardCount>0))
	{
		CDC * pWindowDC=GetDC();
		CAFCImageHandle CardHandle(&m_CardPic);
		CardHandle.BitBlt(pWindowDC->GetSafeHdc(),0,0,(m_bCardCount==1)?m_iCardWidth:m_iCardHSpace,m_iCardHight,
			GetCardXPos(m_CardArray[0])*m_iCardWidth,GetCardYPos(m_CardArray[0])*m_iCardHight);
		ReleaseDC(pWindowDC);
		SetCapture();
	}

	return;
}
示例#5
0
//重画函数
void CCardControl::OnPaint()
{
	CPaintDC dc(this);

	//获取位置
	CRect rcClient;
	GetClientRect(&rcClient);

	//加载位图
	CImage ImageBuffer;
	CImageHandle HandleCard(&m_ImageCard);
	CImageHandle HandleFundus(&m_ImageBack);
	ImageBuffer.Create(rcClient.Width(),rcClient.Height(),16);
	if (ImageBuffer.IsNull()==true) return;

	//绘画扑克													                                              
	CDC * pBufferDC=CDC::FromHandle(ImageBuffer.GetDC());

     if(bDrawCard)																	               //add
     {																							   //add
	     for (int i=0;i<m_CardDataArray.GetCount();i++)				   				     
	     {
		   
			 BYTE bCardData=m_CardDataArray[i];
			 m_ImageCard.AlphaDrawImage(pBufferDC,i*CARD_SPACE,0,CARD_WIDTH,CARD_HEIGHT,GetCardXPos(bCardData),GetCardYPos(bCardData),RGB(255,0,255)); //非常好的画图函数
	     }
		    
	 }
    /////////////////////////////////////////////////////////////////////////////////////////begin add
     else																			
     {
		 
	    for(int i=0;i<m_CardDataArray.GetCount();i++)
	    {
			m_ImageBack.AlphaDrawImage(pBufferDC,i*CARD_SPACE,0,CARD_WIDTH,CARD_HEIGHT,3*CARD_WIDTH,4*CARD_HEIGHT,RGB(255,0,255));     //画扑克背面
		}
	 }
    ///////////////////////////////////////////////////////////////////////////////////////////end add
	ImageBuffer.ReleaseDC();
	ImageBuffer.BitBlt(dc,0,0);

	//清理资源
	ImageBuffer.Destroy();

   	return;
}
示例#6
0
//重画函数
void CUpGradeGameCard::OnPaint()
{
	CPaintDC dc(this);
	if (m_bCardCount==0) return;

	//建立缓冲
	CDC BufferDC;
	CSize CardSize;
	CBitmap BufferBmp;
	GetCardSize(CardSize);
	BufferDC.CreateCompatibleDC(&dc);
	BufferBmp.CreateCompatibleBitmap(&dc,CardSize.cx,CardSize.cy);
	CBitmap * pOldBmp=BufferDC.SelectObject(&BufferBmp);

	//加载位图
	//	CAFCImageHandle CardHandle(&m_CardPic[0]);
	CGameImageHelper CardHandle(&m_CardPic[0]);
	//	CGameImageHelper CardHandle(&m_CardPic[0]);
	CGameImageHelper BackHandle(&m_CardPic[1]);
	CGameImageHelper SmallHandle(&m_CardPic[2]);		//小牌
	CGameImageHelper SmallBackHandle(&m_CardPic[3]);	//小牌大小猫

	//绘画扑克
	int iXPos=0,iYPos=0;
	CGameImageHelper * pActiveHandle=NULL;
	for (BYTE i=0;i<m_bCardCount;i++)
	{
		BYTE bCard=m_CardArray.GetAt(i);
		BYTE bUpCard=m_CardUpArray.GetAt(i);
		if ((m_bShowCard==true)&&(m_CardArray.GetAt(i)!=0))
		{
			if ((bCard==0x4E)||(bCard==0x4F))
			{
				if(IMAGE_SMALL == GetCardStyle() )
				{
					iXPos=(bCard-0x4D)*m_iCardWidth;
					iYPos=0;
					pActiveHandle=&SmallBackHandle;		
				}else
				{
					iXPos=(bCard-0x4D)*m_iCardWidth;
					iYPos=0;
					pActiveHandle=&BackHandle;		
				}
			}
			else
			{
				if(IMAGE_SMALL == GetCardStyle() )
				{
					pActiveHandle=&SmallHandle;
					iXPos=GetCardXPos(bCard)*m_iCardWidth;
					iYPos=GetCardYPos(bCard)*m_iCardHight;
				}else
				{
					pActiveHandle=&CardHandle;
					iXPos=GetCardXPos(bCard)*m_iCardWidth;
					iYPos=GetCardYPos(bCard)*m_iCardHight;
				}

			}
		}
		else
		{
			iXPos=0;
			iYPos=0;
			if(IMAGE_SMALL == GetCardStyle() )
				pActiveHandle=&SmallBackHandle;
			else
				pActiveHandle=&BackHandle;
		}

		if (m_bHorzLook==true) 
			pActiveHandle->BitBlt(BufferDC,i*m_iCardHSpace,bUpCard?0:m_iCardUpSpace,m_iCardWidth,m_iCardHight,iXPos,iYPos);
		else pActiveHandle->BitBlt(BufferDC,0,i*m_iCardVSpace,m_iCardWidth,m_iCardHight,iXPos,iYPos);
	}

	//刷新界面
	dc.BitBlt(0,0,CardSize.cx,CardSize.cy,&BufferDC,0,0,SRCCOPY);

	CRect rect,rect1;
	//牌区大矩形
	rect.left=0;
	rect.right=CardSize.cx;
	if(m_bHorzLook)
		rect.top = CardSize.cy - m_iCardHight;
	else 
		rect.top =0;
	rect.bottom=CardSize.cy;

	switch(m_bShowNum)
	{
	case 1:
		if (m_bHorzLook==true) 		//小矩形
		{
			rect1.left =  rect.right - m_iCardWidth;
			rect1.top =  rect.top;
			rect1.bottom = rect.bottom;
			rect1.right = rect.right;
		}else
		{
			rect1.left =  rect.left ;
			rect1.top =  rect.bottom - m_iCardHight;
			rect1.bottom = rect.bottom ;
			rect1.right = rect.right;;
		}
		break;	
	case 2:
		break;
	case 3:
		break;
	default:
		break;
	}
	int iNumWidth = 36,iNumHeight = 41;

	CDC NumDC;
	NumDC.CreateCompatibleDC(&dc);

	CGameImageHelper Num(&m_NowThis);

	NumDC.SelectObject(Num);
	int xoffset =(rect1.Width()-( m_bCardCount >=10?2:1)*iNumWidth)/2;
	int yoffset = (rect1.Height()-iNumHeight)/2;
	if (m_bShowNum)
		dc.TransparentBlt(rect1.left+xoffset,rect1.top+yoffset,Num.GetWidth(),Num.GetHeight(),&NumDC,0,0,Num.GetWidth(),Num.GetHeight(),RGB(255,0,255));

	//清理资源
	BufferDC.SelectObject(pOldBmp);
	BufferDC.DeleteDC();
	NumDC.DeleteDC();
	BufferBmp.DeleteObject();

	return;
}