CBitmap m_BoardBmp;
The CImageList m_ChessMap;
//create pieces
M_ChessMap. Create (IDB_B_CHESS, 31, 15, RGB (0128128));
//drawing
Void CChessDlg: : OnPaint ()
{
CPaintDC dc (this);
The CDC MemDC;
POINT pt;
CBitmap * pOldBmp;
//load board bitmap
MemDC. CreateCompatibleDC (& amp; Dc);
M_BoardBmp. LoadBitmap (IDB_Chess);
POldBmp=MemDC. SelectObject (& amp; M_BoardBmp);
//literally defines a position here, but pieces can't show, can only display board
Int z=10;
Pt. X=50;
Pt. Y=50;
M_ChessMap. The Draw (& amp; MemDC, z, pt, ILD_TRANSPARENT);
Dc. BitBlt (0, 0, m_nBoardWidth m_nBoardHeight, & amp; MemDC, 0, 0, SRCCOPY);
MemDC. SelectObject (& amp; POldBmp);
MemDC. DeleteDC ();
M_BoardBmp. DeleteObject ();
}
CodePudding user response:

CodePudding user response:
M_ChessMap. The Draw (& amp; MemDC, z, pt, ILD_TRANSPARENT);Is a piece?
Put the board behind the picture
CodePudding user response:

CodePudding user response:
Xie, invited two in front of the building has shown, you try to annotate the code down the board, should can see the piece alone and displayed