DemoView.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // DemoView.cpp : implementation of the CDemoView class
  2. //
  3. #include "stdafx.h"
  4. #include "Demo.h"
  5. #include "DemoDoc.h"
  6. #include "DemoView.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CDemoView
  14. IMPLEMENT_DYNCREATE(CDemoView, CResizableFormView)
  15. BEGIN_MESSAGE_MAP(CDemoView, CResizableFormView)
  16. //{{AFX_MSG_MAP(CDemoView)
  17. //}}AFX_MSG_MAP
  18. END_MESSAGE_MAP()
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CDemoView construction/destruction
  21. CDemoView::CDemoView()
  22. : CResizableFormView(CDemoView::IDD)
  23. {
  24. //{{AFX_DATA_INIT(CDemoView)
  25. // NOTE: the ClassWizard will add member initialization here
  26. //}}AFX_DATA_INIT
  27. }
  28. CDemoView::~CDemoView()
  29. {
  30. }
  31. void CDemoView::DoDataExchange(CDataExchange* pDX)
  32. {
  33. CResizableFormView::DoDataExchange(pDX);
  34. //{{AFX_DATA_MAP(CDemoView)
  35. // NOTE: the ClassWizard will add DDX and DDV calls here
  36. //}}AFX_DATA_MAP
  37. }
  38. BOOL CDemoView::PreCreateWindow(CREATESTRUCT& cs)
  39. {
  40. return CResizableFormView::PreCreateWindow(cs);
  41. }
  42. void CDemoView::OnInitialUpdate()
  43. {
  44. // complete initialization
  45. CResizableFormView::OnInitialUpdate();
  46. // use template size as min track size
  47. CRect rect(CPoint(0, 0), GetTotalSize());
  48. CalcWindowRect(rect, CWnd::adjustOutside);
  49. SetMinTrackSize(rect.Size());
  50. // SetScaleToFitSize(GetTotalSize()); // scrollbars won't appear
  51. }
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CDemoView diagnostics
  54. #ifdef _DEBUG
  55. void CDemoView::AssertValid() const
  56. {
  57. CResizableFormView::AssertValid();
  58. }
  59. void CDemoView::Dump(CDumpContext& dc) const
  60. {
  61. CResizableFormView::Dump(dc);
  62. }
  63. CDemoDoc* CDemoView::GetDocument() // non-debug version is inline
  64. {
  65. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDemoDoc)));
  66. return (CDemoDoc*)m_pDocument;
  67. }
  68. #endif //_DEBUG
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CDemoView message handlers
  71. BOOL CDemoView::OnInitDialog()
  72. {
  73. CResizableFormView::OnInitDialog();
  74. // add controls to the layout here
  75. AddAnchor(IDC_EDIT1, TOP_LEFT);
  76. AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT);
  77. AddAnchor(IDC_GROUP1, TOP_LEFT, BOTTOM_LEFT);
  78. AddAnchor(IDC_RADIO1, TOP_LEFT);
  79. AddAnchor(IDC_RADIO2, MIDDLE_LEFT);
  80. AddAnchor(IDC_RADIO3, BOTTOM_LEFT);
  81. return TRUE; // return TRUE unless you set the focus to a control
  82. // EXCEPTION: OCX Property Pages should return FALSE
  83. }