home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / src / winctrl7.cpp < prev    next >
C/C++ Source or Header  |  1998-06-16  |  2KB  |  71 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #include "stdafx.h"
  12.  
  13. #ifdef AFX_CMNCTL_SEG
  14. #pragma code_seg(AFX_CMNCTL_SEG)
  15. #endif
  16.  
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21.  
  22. #define new DEBUG_NEW
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CImageList
  26.  
  27. BOOL CImageList::DrawIndirect(IMAGELISTDRAWPARAMS* pimldp)
  28. {
  29.     ASSERT(m_hImageList != NULL);
  30.     ASSERT_POINTER(pimldp, IMAGELISTDRAWPARAMS);
  31.  
  32.     pimldp->cbSize = sizeof(IMAGELISTDRAWPARAMS);
  33.     pimldp->himl = m_hImageList;
  34.     return ImageList_DrawIndirect(pimldp);
  35. }
  36.  
  37. BOOL CImageList::DrawIndirect(CDC* pDC, int nImage, POINT pt,
  38.         SIZE sz, POINT ptOrigin, UINT fStyle /* = ILD_NORMAL */,
  39.         DWORD dwRop /* = SRCCOPY */, COLORREF rgbBack /* = CLR_DEFAULT */,
  40.         COLORREF rgbFore /* = CLR_DEFAULT */)
  41. {
  42.     ASSERT_POINTER(pDC, CDC);
  43.     ASSERT(pDC->m_hDC != NULL);
  44.  
  45.     IMAGELISTDRAWPARAMS drawing;
  46.  
  47.     drawing.i = nImage;
  48.     drawing.hdcDst = pDC->m_hDC;
  49.     drawing.x = pt.x;
  50.     drawing.y = pt.y;
  51.     drawing.cx = sz.cx;
  52.     drawing.cy = sz.cy;
  53.     drawing.xBitmap = ptOrigin.x;
  54.     drawing.yBitmap = ptOrigin.y;
  55.     drawing.rgbBk = rgbBack;
  56.     drawing.rgbFg = rgbFore;
  57.     drawing.fStyle = fStyle;
  58.     drawing.dwRop = dwRop;
  59.  
  60.     // this call initializes cbSize and himl;
  61.     return DrawIndirect(&drawing);
  62. }
  63.  
  64. BOOL CImageList::Create(CImageList* pImageList)
  65. {
  66.     ASSERT(pImageList != NULL);
  67.     return Attach(ImageList_Duplicate(pImageList->m_hImageList));
  68. }
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71.