回复 94楼 hellovfp
大哥能把你写的Image类发下吗 想参考下你们的方法。梅尚程荀
马谭杨奚
// Draw On the lattice 根据具体消息在格子上画图 static void DrawLattice(int cPos, BOOL select) { int PosTurn, cx, cy, ChessmanID; PosTurn = WV.bTurn ? LatticeTurn(cPos) : cPos; cx = BoardEdge + (GetX(PosTurn) - 3) * LatticeSize; cy = BoardEdge + (GetY(PosTurn) - 3) * LatticeSize; SelectObject(WV.hdcTemp, WV.hbmpBoard); BitBlt(WV.hdcMain, cx, cy, LatticeSize, LatticeSize, WV.hdcTemp, cx, cy, SRCCOPY); ChessmanID = State.Chessman[cPos]; if (ChessmanID != 0) DrawTransMap(WV.hdcMain, WV.hdcTemp, cx, cy, WV.hbmpChessman[ChessmanID]); if (select != 0) DrawTransMap(WV.hdcMain, WV.hdcTemp, cx, cy, WV.hbmpSelected); }
case WM_CREATE: GetWindowRect(hWnd, &rect); x = rect.left; y = rect.top; rect.right = rect.left + BoardWidth; rect.bottom = rect.top + BoardHeight ; AdjustWindowRect(&rect, WINDOW_STYLES, TRUE); MoveWindow(hWnd, x, y, rect.right - rect.left, rect.bottom - rect.top, TRUE); break;
#define WINDOW_STYLES WS_OVERLAPPEDWINDOW | WS_SYSMENU | WS_CAPTION const int LatticeSize = 52; const int BoardEdge = 4; const int BoardWidth = 2 * BoardEdge + 9 * LatticeSize; const int BoardHeight = 2 * BoardEdge + 10 * LatticeSize;