home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / common / msdev98 / bin / ide / devgal.pkg / TEMPLATE / 22336 < prev    next >
Encoding:
Text File  |  1998-06-18  |  1.5 KB  |  64 lines

  1. // $$VAL:PREVIEWIMPLEMENTATION$$ : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "$$VAL:RESINC$$"
  6. #include "$$VAL:PREVIEWHEADER$$"
  7.  
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char BASED_CODE THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // $$VAL:PREVIEWCLASS$$
  15.  
  16. $$VAL:PREVIEWCLASS$$::$$VAL:PREVIEWCLASS$$()
  17. {
  18. }
  19.  
  20. $$VAL:PREVIEWCLASS$$::~$$VAL:PREVIEWCLASS$$()
  21. {
  22. }
  23.  
  24.  
  25. BEGIN_MESSAGE_MAP($$VAL:PREVIEWCLASS$$, CWnd)
  26.     //{{AFX_MSG_MAP($$VAL:PREVIEWCLASS$$)
  27.     ON_WM_PAINT()
  28.     ON_WM_ERASEBKGND()
  29.     //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31.  
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // $$VAL:PREVIEWCLASS$$ message handlers
  35.  
  36. void $$VAL:PREVIEWCLASS$$::OnPaint() 
  37. {
  38.     // TODO: Add your custom preview paint code.
  39.     // For an example, we are drawing a blue ellipse.
  40.  
  41.     CPaintDC dc(this); // device context for painting
  42.     CRect rect;
  43.     GetClientRect(rect);
  44.  
  45.     CBrush brushNew(RGB(0,0,255));
  46.     CBrush* pBrushOld = dc.SelectObject(&brushNew);
  47.     dc.Ellipse(rect);
  48.     dc.SelectObject(pBrushOld);
  49. }
  50.  
  51. BOOL $$VAL:PREVIEWCLASS$$::OnEraseBkgnd(CDC* pDC) 
  52. {
  53.     // Use the same background color as that of the dialog
  54.     //  (property sheet).
  55.  
  56.     CWnd* pParentWnd = GetParent();
  57.     HBRUSH hBrush = (HBRUSH)pParentWnd->SendMessage(WM_CTLCOLORDLG,
  58.         (WPARAM)pDC->m_hDC, (LPARAM)pParentWnd->m_hWnd);
  59.     CRect rect;
  60.     GetClientRect(rect);
  61.     pDC->FillRect(&rect, CBrush::FromHandle(hBrush));
  62.     return TRUE;
  63. }
  64.