+//\r
+// CardLib - CardRegion drawing support\r
+//\r
+// Freeware\r
+// Copyright J Brown 2001\r
+//\r
+#include <windows.h>\r
+#include "cardlib.h"\r
+#include "cardregion.h"\r
+#include "cardcolor.h"\r
+\r
+HPALETTE UseNicePalette(HDC hdc, HPALETTE hPalette);\r
+void PaintRect(HDC hdc, RECT *rect, COLORREF colour);\r
+void CardBlt(HDC hdc, int x, int y, int nCardNum);\r
+void DrawCard(HDC hdc, int x, int y, HDC hdcSource, int width, int height);\r
+\r
+//\r
+// Draw specified card at position x, y\r
+// xoff - source offset from left of card\r
+// yoff - source offset from top of card\r
+// width - width to draw\r
+// height - height to draw\r
+//\r
+void CardBlt(HDC hdc, int x, int y, int nCardNum)//, int xoff, int yoff, int width, int height)\r
+{\r
+ int sx = nCardNum * __cardwidth;\r
+ int sy = 0;\r
+ int width = __cardwidth;\r
+ int height = __cardheight;\r
+\r
+ //draw main center band\r
+ BitBlt(hdc, x+2, y, width - 4, height, __hdcCardBitmaps, sx+2, sy+0, SRCCOPY);\r
+\r
+ //draw the two bits to the left\r
+ BitBlt(hdc, x, y+2, 1, height - 4, __hdcCardBitmaps, sx+0, sy+2, SRCCOPY);\r
+ BitBlt(hdc, x+1, y+1, 1, height - 2, __hdcCardBitmaps, sx+1, sy+1, SRCCOPY);\r
+\r
+ //draw the two bits to the right\r
+ BitBlt(hdc, x+width-2, y+1, 1, height - 2, __hdcCardBitmaps, sx+width-2, sy+1, SRCCOPY);\r
+ BitBlt(hdc, x+width-1, y+2, 1, height - 4, __hdcCardBitmaps, sx+width-1, sy+2, SRCCOPY);\r
+}\r
+\r
+//\r
+// Draw a shape this this:\r
+//\r
+// ++++++++++++\r
+// ++++++++++++++\r
+// ++ ++\r
+//\r
+void DrawHorzCardStrip(HDC hdc, int x, int y, int nCardNum, int height, BOOL fDrawTips)\r
+{\r
+ int sx = nCardNum * __cardwidth;\r
+ int sy = 0;\r
+ int one = 1;\r
+ int two = 2;\r
+ BOOL tips = fDrawTips ? FALSE : TRUE;\r
+\r
+ if(height == 0) return;\r
+\r
+ if(height < 0)\r
+ {\r
+ sy = sy + __cardheight;\r
+ y -= height;\r
+ one = -one;\r
+ two = -two;\r
+ }\r
+\r
+ // draw the main vertical band\r
+ //\r
+ BitBlt(hdc, x + 2, y, __cardwidth - 4, height, __hdcCardBitmaps, sx+2, sy, SRCCOPY);\r
+\r
+ //if(height <= 1) return;\r
+\r
+ // draw the "lips" at the left and right\r
+ BitBlt(hdc, x+1, y+one, 1, height-one*tips, __hdcCardBitmaps, sx+1, sy+one, SRCCOPY);\r
+ BitBlt(hdc, x+__cardwidth-2, y+one, 1, height-one*tips, __hdcCardBitmaps, sx+__cardwidth-2, sy+one, SRCCOPY);\r
+\r
+ //if(height <= 2) return;\r
+\r
+ // draw the outer-most lips\r
+ BitBlt(hdc, x, y+two, 1, height-two*tips, __hdcCardBitmaps, sx, sy+two, SRCCOPY);\r
+ BitBlt(hdc, x+__cardwidth-1, y+two, 1, height-two*tips, __hdcCardBitmaps, sx+__cardwidth-1, sy+two, SRCCOPY); \r
+}\r
+\r
+//\r
+// Draw a shape like this:\r
+//\r
+// +++\r
+// +++\r
+// +++\r
+// +++\r
+// +++\r
+// +++\r
+// +++\r
+// +++\r
+// +++\r
+// +++\r
+//\r
+//\r
+void DrawVertCardStrip(HDC hdc, int x, int y, int nCardNum, int width, BOOL fDrawTips)\r
+{\r
+ int sx = nCardNum * __cardwidth;\r
+ int sy = 0;\r
+ int one = 1;\r
+ int two = 2;\r
+ BOOL tips = fDrawTips ? FALSE : TRUE;\r
+\r
+ if(width == 0) return;\r
+ \r
+\r
+ if(width < 0)\r
+ {\r
+ sx = sx + __cardwidth;\r
+ x -= width;\r
+ one = -1;\r
+ two = -2;\r
+ }\r
+\r
+ // draw the main vertical band\r
+ //\r
+ BitBlt(hdc, x, y + 2, width, __cardheight - 4, __hdcCardBitmaps, sx, sy+2, SRCCOPY);\r
+\r
+ //if(width <= 1) return;\r
+\r
+ // draw the "lips" at the top and bottom\r
+ BitBlt(hdc, x+one, y+1, width-one*tips, 1, __hdcCardBitmaps, sx+one, sy + 1, SRCCOPY);\r
+ BitBlt(hdc, x+one, y+__cardheight-2, width-one*tips, 1, __hdcCardBitmaps, sx+one, sy + __cardheight-2, SRCCOPY);\r
+\r
+ //if(width <= 2) return;\r
+\r
+ // draw the outer-most lips\r
+ BitBlt(hdc, x+two, y, width-two*tips, 1, __hdcCardBitmaps, sx+two, sy, SRCCOPY);\r
+ BitBlt(hdc, x+two, y+__cardheight-1, width-two*tips, 1, __hdcCardBitmaps, sx+two, sy + __cardheight-1, SRCCOPY);\r
+}\r
+\r
+//\r
+// xdir - <0 or >0\r
+// ydir - <0 or >0\r
+//\r
+void DrawCardCorner(HDC hdc, int x, int y, int cardval, int xdir, int ydir)\r
+{\r
+ int sx = cardval * __cardwidth;\r
+ int sy = 0;\r
+\r
+ HDC hdcSource = __hdcCardBitmaps;\r
+\r
+ if(xdir < 0) \r
+ {\r
+ x += __cardwidth + xdir - 1;\r
+ sx += __cardwidth + xdir - 1;\r
+ }\r
+ else\r
+ {\r
+ x += xdir;\r
+ sx += xdir;\r
+ }\r
+\r
+ if(ydir < 0) \r
+ {\r
+ y += __cardheight + ydir - 1;\r
+ sy += __cardheight + ydir - 1;\r
+ }\r
+ else\r
+ {\r
+ y += ydir;\r
+ sy += ydir;\r
+ }\r
+\r
+ //convert x,y directions to -1, +1\r
+ xdir = xdir < 0 ? -1 : 1;\r
+ ydir = ydir < 0 ? -1 : 1;\r
+\r
+ SetPixel(hdc, x+xdir, y , GetPixel(hdcSource, sx+xdir, sy));\r
+ SetPixel(hdc, x, y, GetPixel(hdcSource, sx, sy));\r
+ SetPixel(hdc, x, y+ydir, GetPixel(hdcSource, sx, sy+ydir));\r
+\r
+}\r
+\r
+//\r
+// Draw a card (i.e. miss out the corners)\r
+//\r
+void DrawCard(HDC hdc, int x, int y, HDC hdcDragCard, int width, int height)\r
+{\r
+ //draw main center band\r
+ BitBlt(hdc, x+2, y, width - 4, height, hdcDragCard, 2, 0, SRCCOPY);\r
+\r
+ //draw the two bits to the left\r
+ BitBlt(hdc, x, y+2, 1, height - 4, hdcDragCard, 0, 2, SRCCOPY);\r
+ BitBlt(hdc, x+1, y+1, 1, height - 2, hdcDragCard, 1, 1, SRCCOPY);\r
+\r
+ //draw the two bits to the right\r
+ BitBlt(hdc, x+width-2, y+1, 1, height - 2, hdcDragCard, width-2, 1, SRCCOPY);\r
+ BitBlt(hdc, x+width-1, y+2, 1, height - 4, hdcDragCard, width-1, 2, SRCCOPY);\r
+}\r
+\r
+//\r
+// Clip a card SHAPE - basically any rectangle\r
+// with rounded corners\r
+//\r
+int ClipCard(HDC hdc, int x, int y, int width, int height)\r
+{\r
+ ExcludeClipRect(hdc, x+2, y, x+2+width-4, y+ height);\r
+ ExcludeClipRect(hdc, x, y+2, x+1, y+2+height-4);\r
+ ExcludeClipRect(hdc, x+1, y+1, x+2, y+1+height-2);\r
+ ExcludeClipRect(hdc, x+width-2, y+1, x+width-2+1, y+1+height-2);\r
+ ExcludeClipRect(hdc, x+width-1, y+2, x+width-1+1, y+2+height-4);\r
+ return 0;\r
+}\r
+\r
+void CardRegion::Clip(HDC hdc)\r
+{\r
+ int numtoclip;\r
+\r
+ if(fVisible == false) \r
+ return;\r
+\r
+ Update(); //Update this stack's size+card count\r
+ numtoclip = nNumApparentCards;\r
+\r
+ //if we are making this stack flash on/off, then only \r
+ //clip the stack for drawing if the flash is in its ON state\r
+ if(nFlashCount != 0)\r
+ {\r
+ if(fFlashVisible == FALSE)\r
+ numtoclip = 0;\r
+ }\r
+\r
+ //if offset along a diagonal\r
+ if(xoffset != 0 && yoffset != 0 && cardstack.NumCards() != 0)\r
+ {\r
+ for(int j = 0; j < numtoclip; j ++)\r
+ { \r
+ ClipCard(hdc, xpos + xoffset * j, ypos + yoffset * j, __cardwidth, __cardheight);\r
+ } \r
+ }\r
+ //otherwise if just offset along a horizontal/vertical axis\r
+ else\r
+ {\r
+ if(yoffset < 0 && numtoclip > 0)\r
+ {\r
+ ClipCard(hdc, xpos, ypos-((numtoclip-1)*-yoffset), width, height);\r
+ }\r
+ else if(xoffset < 0 && numtoclip > 0)\r
+ {\r
+ ClipCard(hdc, xpos-((numtoclip-1)*-xoffset), ypos, width, height);\r
+ }\r
+ else\r
+ {\r
+ ClipCard(hdc, xpos, ypos, width, height);\r
+ }\r
+ }\r
+\r
+}\r
+\r
+void CardRegion::Render(HDC hdc)\r
+{\r
+ int cardnum = 0;\r
+ int numtodraw;\r
+ BOOL fDrawTips;\r
+ \r
+ Update(); //Update this stack's card count + size\r
+\r
+ numtodraw = nNumApparentCards;\r
+\r
+ if(nFlashCount != 0)\r
+ {\r
+ if(fFlashVisible == false)\r
+ numtodraw = 0;\r
+ }\r
+\r
+ if(fVisible == 0) return;\r
+ \r
+ cardnum = cardstack.NumCards() - numtodraw;\r
+ int counter;\r
+\r
+ for(counter = 0; counter < numtodraw; counter++)\r
+ {\r
+ int cardval;\r
+ \r
+ int x = xoffset * counter + xpos;\r
+ int y = yoffset * counter + ypos;\r
+\r
+ //if about to draw last card, then actually draw the top card\r
+ if(counter == numtodraw - 1) cardnum = cardstack.NumCards() - 1;\r
+ \r
+ Card card = cardstack.cardlist[cardnum];\r
+ cardval = card.Idx();\r
+ \r
+ if(card.FaceDown())\r
+ cardval = nBackCardIdx; //card-back\r
+ \r
+ //only draw the visible part of the card\r
+ if(counter < numtodraw - 1)\r
+ {\r
+ if(yoffset != 0 && xoffset != 0)\r
+ fDrawTips = FALSE;\r
+ else\r
+ fDrawTips = TRUE;\r
+\r
+ if(yoffset != 0 && abs(xoffset) == 1 || xoffset != 0 && abs(yoffset) == 1)\r
+ fDrawTips = TRUE;\r
+\r
+ //draw horizontal strips\r
+ if(yoffset > 0) \r
+ {\r
+ DrawHorzCardStrip(hdc, x, y, cardval, yoffset, fDrawTips);\r
+ }\r
+ else if(yoffset < 0)\r
+ {\r
+ DrawHorzCardStrip(hdc, x, y+__cardheight+yoffset, cardval, yoffset, fDrawTips);\r
+ }\r
+\r
+ //draw some vertical bars\r
+ if(xoffset > 0)\r
+ {\r
+ DrawVertCardStrip(hdc, x, y, cardval, xoffset, fDrawTips);\r
+ }\r
+ else if(xoffset < 0)\r
+ {\r
+ DrawVertCardStrip(hdc, x+__cardwidth+xoffset, y, cardval, xoffset, fDrawTips);\r
+ }\r
+\r
+ if(yoffset != 0 && xoffset != 0)//fDrawTips == FALSE)\r
+ {\r
+ //if we didn't draw any tips, then this is a 2-dim stack\r
+ //(i.e, it goes at a diagonal).\r
+ //in this case, we need to fill in the small triangle in\r
+ //each corner!\r
+ DrawCardCorner(hdc, x, y, cardval, xoffset, yoffset);\r
+ }\r
+ }\r
+ //if the top card, draw the whole thing\r
+ else\r
+ {\r
+ CardBlt(hdc, x, y, cardval);\r
+ }\r
+\r
+ cardnum ++;\r
+\r
+ } //end of index\r
+ \r
+ if(counter == 0) //if the cardstack is empty, then draw it that way\r
+ {\r
+ int x = xpos;\r
+ int y = ypos;\r
+ \r
+ switch(uEmptyImage)\r
+ {\r
+ default: case CS_EI_NONE:\r
+ //this wipes the RECT variable, so watch out!\r
+ //SetRect(&rect, x, y, x+__cardwidth, y+__cardheight);\r
+ //PaintRect(hdc, &rect, MAKE_PALETTERGB(crBackgnd));\r
+ parentWnd.PaintCardRgn(hdc, x, y, __cardwidth, __cardheight, x, y);\r
+ break;\r
+ \r
+ case CS_EI_SUNK: //case CS_EI_CIRC: case CS_EI_X:\r
+ DrawCard(hdc, x, y, __hdcPlaceHolder, __cardwidth, __cardheight);\r
+ break;\r
+ }\r
+ \r
+ }\r
+\r
+ return;\r
+}\r
+\r
+int calc_offset(int offset, int numcards, int numtodrag, int realvisible)\r
+{\r
+ if(offset >= 0)\r
+ return -offset * numcards;\r
+ else\r
+ return -offset * (numtodrag) + \r
+ -offset * (realvisible - 1);\r
+}\r
+\r
+void CardRegion::PrepareDragBitmaps(int numtodrag)\r
+{\r
+ RECT rect;\r
+ HDC hdc;\r
+ int icard;\r
+ int numcards = cardstack.NumCards();\r
+ int xoff, yoff;\r
+\r
+ if(nThreedCount > 1)\r
+ {\r
+ PrepareDragBitmapsThreed(numtodrag);\r
+ return;\r
+ }\r
+\r
+ //work out how big the bitmaps need to be\r
+ nDragCardWidth = (numtodrag - 1) * abs(xoffset) + __cardwidth;\r
+ nDragCardHeight = (numtodrag - 1) * abs(yoffset) + __cardheight;\r
+\r
+ //Create bitmap for the back-buffer\r
+ hdc = GetDC(NULL);\r
+ hdcBackGnd = CreateCompatibleDC(hdc);\r
+ hbmBackGnd = CreateCompatibleBitmap(hdc, nDragCardWidth, nDragCardHeight);\r
+ SelectObject(hdcBackGnd, hbmBackGnd);\r
+\r
+ //Create bitmap for the drag-image\r
+ hdcDragCard = CreateCompatibleDC(hdc);\r
+ hbmDragCard = CreateCompatibleBitmap(hdc, nDragCardWidth, nDragCardHeight);\r
+ SelectObject(hdcDragCard, hbmDragCard);\r
+ ReleaseDC(NULL, hdc);\r
+\r
+ UseNicePalette(hdcBackGnd, __hPalette);\r
+ UseNicePalette(hdcDragCard, __hPalette);\r
+\r
+ int realvisible = numcards / nThreedCount;\r
+\r
+ //if(numcards > 0 && realvisible == 0) realvisible = 1;\r
+ int iwhichcard = numcards - 1;\r
+ if(nThreedCount == 1) iwhichcard = 0;\r
+\r
+ //grab the first bit of background so we can prep the back buffer; do this by\r
+ //rendering the card stack (minus the card we are dragging) to the temporary\r
+ //background buffer, so it appears if we have lifted the card from the stack\r
+ //PaintRect(hdcBackGnd, &rect, crBackgnd);\r
+ SetRect(&rect, 0, 0, nDragCardWidth, nDragCardHeight);\r
+ \r
+ xoff = calc_offset(xoffset, numcards, numtodrag, realvisible);\r
+ yoff = calc_offset(yoffset, numcards, numtodrag, realvisible);\r
+ \r
+ parentWnd.PaintCardRgn(hdcBackGnd, 0, 0, nDragCardWidth, nDragCardHeight, xpos - xoff, ypos - yoff);\r
+\r
+ //\r
+ // Render the cardstack into the back-buffer. The stack\r
+ // has already had the dragcards removed, so just draw\r
+ // what is left\r
+ //\r
+ for(icard = 0; icard < realvisible; icard++)\r
+ {\r
+ Card card = cardstack.cardlist[iwhichcard];\r
+ int nCardVal;\r
+ \r
+ nCardVal = card.FaceUp() ? card.Idx() : nBackCardIdx;\r
+\r
+ xoff = xoffset * icard + calc_offset(xoffset, numcards, numtodrag, realvisible);//- xoffset * ((numcards+numtodrag) / nThreedCount - numtodrag);\r
+ yoff = yoffset * icard + calc_offset(yoffset, numcards, numtodrag, realvisible);//- yoffset * ((numcards+numtodrag) / nThreedCount - numtodrag);\r
+\r
+ CardBlt(hdcBackGnd, xoff, yoff, nCardVal);\r
+ iwhichcard++;\r
+ }\r
+ \r
+ //\r
+ // If there are no cards under this one, just draw the place holder\r
+ //\r
+ if(numcards == 0) \r
+ {\r
+ int xoff = 0, yoff = 0;\r
+\r
+ if(xoffset < 0) xoff = nDragCardWidth - __cardwidth;\r
+ if(yoffset < 0) yoff = nDragCardHeight - __cardheight;\r
+\r
+ switch(uEmptyImage)\r
+ {\r
+ case CS_EI_NONE:\r
+ //No need to draw anything: We already cleared the\r
+ //back-buffer before the main loop..\r
+\r
+ //SetRect(&rc, xoff, yoff, xoff+ __cardwidth, yoff + __cardheight);\r
+ //PaintRect(hdcBackGnd, &rc, MAKE_PALETTERGB(crBackgnd));\r
+ //parentWnd.PaintCardRgn(hdcBackGnd, xoff, yoff, __cardwidth, __cardheight, xpos, ypos);// + xoff, ypos + yoff);\r
+ break;\r
+\r
+ case CS_EI_SUNK:\r
+ DrawCard(hdcBackGnd, xoff, yoff, __hdcPlaceHolder, __cardwidth, __cardheight);\r
+ break;\r
+ }\r
+ }\r
+\r
+ //\r
+ // now render the drag-cards into the dragcard image\r
+ //\r
+ PaintRect(hdcDragCard, &rect, crBackgnd);\r
+\r
+ for(icard = 0; icard < numtodrag; icard++)\r
+ {\r
+ int nCardVal;\r
+\r
+ if(xoffset >= 0) xoff = xoffset * icard;\r
+ else xoff = -xoffset * (numtodrag - icard - 1);\r
+ \r
+ if(yoffset >= 0) yoff = yoffset * icard;\r
+ else yoff = -yoffset * (numtodrag - icard - 1);\r
+\r
+ Card card = dragstack.cardlist[icard];\r
+ \r
+ nCardVal = card.FaceUp() ? card.Idx() : nBackCardIdx;\r
+\r
+ CardBlt(hdcDragCard, xoff, yoff, nCardVal);\r
+ }\r
+}\r
+\r
+void CardRegion::PrepareDragBitmapsThreed(int numtodrag)\r
+{\r
+ RECT rect;\r
+ HDC hdc;\r
+ int icard;\r
+ int numunder = 0;\r
+ int iwhichcard;\r
+\r
+ int numcards = cardstack.NumCards();\r
+\r
+ //work out how big the bitmaps need to be\r
+ nDragCardWidth = (numtodrag - 1) * abs(xoffset) + __cardwidth;\r
+ nDragCardHeight = (numtodrag - 1) * abs(yoffset) + __cardheight;\r
+\r
+ //Create bitmap for the back-buffer\r
+ hdc = GetDC(NULL);\r
+ hdcBackGnd = CreateCompatibleDC(hdc);\r
+ hbmBackGnd = CreateCompatibleBitmap(hdc, nDragCardWidth, nDragCardHeight);\r
+ SelectObject(hdcBackGnd, hbmBackGnd);\r
+\r
+ //create bitmap for the drag-image\r
+ hdcDragCard = CreateCompatibleDC(hdc);\r
+ hbmDragCard = CreateCompatibleBitmap(hdc, nDragCardWidth, nDragCardHeight);\r
+ SelectObject(hdcDragCard, hbmDragCard);\r
+ ReleaseDC(NULL, hdc);\r
+\r
+ UseNicePalette(hdcBackGnd, __hPalette);\r
+ UseNicePalette(hdcDragCard, __hPalette);\r
+\r
+ //grab the first bit of background so we can prep the back buffer; do this by\r
+ //rendering the card stack (minus the card we are dragging) to the temporary\r
+ //background buffer, so it appears if we have lifted the card from the stack\r
+ //--SetRect(&rect, 0, 0, nDragCardWidth, nDragCardHeight);\r
+ //--PaintRect(hdcBackGnd, &rect, crBackgnd);\r
+\r
+ int threedadjust = numcards % nThreedCount == 0;\r
+ \r
+ numunder = CalcApparentCards(numcards);\r
+ iwhichcard = (numcards+numtodrag) - numunder - 1;\r
+ if(nThreedCount == 1) iwhichcard = 0;\r
+ \r
+ int xoff = calc_offset(xoffset, numunder, numtodrag, numunder);\r
+ int yoff = calc_offset(yoffset, numunder, numtodrag, numunder);\r
+\r
+ parentWnd.PaintCardRgn(hdcBackGnd, 0,0, nDragCardWidth,nDragCardHeight, xpos - xoff,ypos - yoff);\r
+\r
+ //\r
+ // Render the cardstack into the back-buffer. The stack\r
+ // has already had the dragcards removed, so just draw\r
+ // what is left\r
+ //\r
+ for(icard = 0; icard < numunder; icard++)\r
+ {\r
+ Card card = cardstack.cardlist[iwhichcard];\r
+ int nCardVal = card.FaceUp() ? card.Idx() : nBackCardIdx;\r
+\r
+ CardBlt(hdcBackGnd, \r
+ xoffset * icard - xoffset*(numunder-numtodrag+threedadjust),\r
+ yoffset * icard - yoffset*(numunder-numtodrag+threedadjust),\r
+ nCardVal);\r
+\r
+ iwhichcard++;\r
+ }\r
+ \r
+ //\r
+ // If there are no cards under this one, just draw the place holder\r
+ //\r
+ if(numcards == 0) \r
+ {\r
+ switch(uEmptyImage)\r
+ {\r
+ case CS_EI_NONE:\r
+ //no need! we've already cleared the whole\r
+ //back-buffer before the main loop!\r
+ //SetRect(&rect, 0, 0, __cardwidth, __cardheight);\r
+ //PaintRect(hdcBackGnd, &rect, MAKE_PALETTERGB(crBackgnd));\r
+ break;\r
+\r
+ case CS_EI_SUNK:\r
+ DrawCard(hdcBackGnd, 0, 0, __hdcPlaceHolder, __cardwidth, __cardheight);\r
+ break;\r
+ \r
+ }\r
+ }\r
+\r
+ //\r
+ // now render the drag-cards into the dragcard image\r
+ //\r
+ PaintRect(hdcDragCard, &rect, crBackgnd);\r
+ \r
+ for(icard = 0; icard < numtodrag; icard++)\r
+ {\r
+ Card card = dragstack.cardlist[icard];\r
+ int nCardVal = card.FaceUp() ? card.Idx() : nBackCardIdx;\r
+\r
+ CardBlt(hdcDragCard, xoffset * icard, yoffset * icard, nCardVal);\r
+ }\r
+}\r
+\r
+void CardRegion::ReleaseDragBitmaps(void)\r
+{\r
+ //SelectObject(hdcBackGnd, hOld1);\r
+ DeleteObject(hbmBackGnd);\r
+ DeleteDC(hdcBackGnd);\r
+\r
+ //SelectObject(hdcDragCard, hOld2);\r
+ DeleteObject(hbmDragCard);\r
+ DeleteDC(hdcDragCard);\r
+}\r
+\r
+\r
+void CardRegion::Redraw()\r
+{\r
+ HDC hdc = GetDC((HWND)parentWnd);\r
+\r
+ Update();\r
+ Render(hdc);\r
+\r
+ ReleaseDC((HWND)parentWnd, hdc);\r
+}\r