home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / MINSPLIT.ZIP / MinSplitSizeView.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-07  |  2.5 KB  |  101 lines

  1. // MinSplitSizeView.cpp : implementation of the CMinSplitSizeView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "MinSplitSize.h"
  6.  
  7. #include "MinSplitSizeDoc.h"
  8. #include "MinSplitSizeView.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CMinSplitSizeView
  18.  
  19. IMPLEMENT_DYNCREATE(CMinSplitSizeView, CView)
  20.  
  21. BEGIN_MESSAGE_MAP(CMinSplitSizeView, CView)
  22.     //{{AFX_MSG_MAP(CMinSplitSizeView)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CMinSplitSizeView construction/destruction
  30.  
  31. CMinSplitSizeView::CMinSplitSizeView()
  32. {
  33.     // TODO: add construction code here
  34.  
  35. }
  36.  
  37. CMinSplitSizeView::~CMinSplitSizeView()
  38. {
  39. }
  40.  
  41. BOOL CMinSplitSizeView::PreCreateWindow(CREATESTRUCT& cs)
  42. {
  43.     // TODO: Modify the Window class or styles here by modifying
  44.     //  the CREATESTRUCT cs
  45.  
  46.     return CView::PreCreateWindow(cs);
  47. }
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CMinSplitSizeView drawing
  51.  
  52. void CMinSplitSizeView::OnDraw(CDC* pDC)
  53. {
  54.     CMinSplitSizeDoc* pDoc = GetDocument();
  55.     ASSERT_VALID(pDoc);
  56.  
  57.     CRect rcClient;
  58.     GetClientRect( rcClient );
  59.  
  60.     CRect rcDraw( rcClient );
  61.  
  62.     int xCenter = rcDraw.right / 2;
  63.     rcDraw.left = xCenter - 20;
  64.     rcDraw.right = xCenter + 20;
  65.  
  66.     int yCenter = rcDraw.bottom / 2;
  67.     rcDraw.top = yCenter - 20;
  68.     rcDraw.bottom = yCenter + 20;
  69.  
  70.     CBrush brushGUI(GetSysColor(COLOR_3DFACE));
  71.     pDC->FillRect( rcDraw, &brushGUI );
  72.  
  73.     CString str;
  74.     str.Format( "%d x %d", rcClient.Width(), rcClient.Height() );
  75.     pDC->DrawText( str, rcDraw, DT_CENTER | DT_VCENTER | DT_NOCLIP );
  76. }
  77.  
  78. /////////////////////////////////////////////////////////////////////////////
  79. // CMinSplitSizeView diagnostics
  80.  
  81. #ifdef _DEBUG
  82. void CMinSplitSizeView::AssertValid() const
  83. {
  84.     CView::AssertValid();
  85. }
  86.  
  87. void CMinSplitSizeView::Dump(CDumpContext& dc) const
  88. {
  89.     CView::Dump(dc);
  90. }
  91.  
  92. CMinSplitSizeDoc* CMinSplitSizeView::GetDocument() // non-debug version is inline
  93. {
  94.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMinSplitSizeDoc)));
  95.     return (CMinSplitSizeDoc*)m_pDocument;
  96. }
  97. #endif //_DEBUG
  98.  
  99. /////////////////////////////////////////////////////////////////////////////
  100. // CMinSplitSizeView message handlers
  101.