CTreeControlBarView.cpp
上传用户:nbkytg
上传日期:2021-02-14
资源大小:126k
文件大小:3k
源码类别:

工具条

开发平台:

Visual C++

  1. // CTreeControlBarView.cpp : implementation of the CCTreeControlBarView class
  2. //
  3. #include "stdafx.h"
  4. #include "CTreeControlBar.h"
  5. #include "CTreeControlBarDoc.h"
  6. #include "CTreeControlBarView.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CCTreeControlBarView
  14. IMPLEMENT_DYNCREATE(CCTreeControlBarView, CView)
  15. BEGIN_MESSAGE_MAP(CCTreeControlBarView, CView)
  16. //{{AFX_MSG_MAP(CCTreeControlBarView)
  17. // NOTE - the ClassWizard will add and remove mapping macros here.
  18. //    DO NOT EDIT what you see in these blocks of generated code!
  19. //}}AFX_MSG_MAP
  20. // Standard printing commands
  21. ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
  22. ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
  23. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  24. END_MESSAGE_MAP()
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CCTreeControlBarView construction/destruction
  27. CCTreeControlBarView::CCTreeControlBarView()
  28. {
  29. // TODO: add construction code here
  30. m_Title="将显示树中节点文本";
  31. }
  32. CCTreeControlBarView::~CCTreeControlBarView()
  33. {
  34. }
  35. BOOL CCTreeControlBarView::PreCreateWindow(CREATESTRUCT& cs)
  36. {
  37. // TODO: Modify the Window class or styles here by modifying
  38. //  the CREATESTRUCT cs
  39. return CView::PreCreateWindow(cs);
  40. }
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CCTreeControlBarView drawing
  43. void CCTreeControlBarView::OnDraw(CDC* pDC)
  44. {
  45. CCTreeControlBarDoc* pDoc = GetDocument();
  46. ASSERT_VALID(pDoc);
  47. // TODO: add draw code for native data here
  48. DrawRect(pDC);
  49. }
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CCTreeControlBarView printing
  52. BOOL CCTreeControlBarView::OnPreparePrinting(CPrintInfo* pInfo)
  53. {
  54. // default preparation
  55. return DoPreparePrinting(pInfo);
  56. }
  57. void CCTreeControlBarView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  58. {
  59. // TODO: add extra initialization before printing
  60. }
  61. void CCTreeControlBarView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  62. {
  63. // TODO: add cleanup after printing
  64. }
  65. /////////////////////////////////////////////////////////////////////////////
  66. // CCTreeControlBarView diagnostics
  67. #ifdef _DEBUG
  68. void CCTreeControlBarView::AssertValid() const
  69. {
  70. CView::AssertValid();
  71. }
  72. void CCTreeControlBarView::Dump(CDumpContext& dc) const
  73. {
  74. CView::Dump(dc);
  75. }
  76. CCTreeControlBarDoc* CCTreeControlBarView::GetDocument() // non-debug version is inline
  77. {
  78. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCTreeControlBarDoc)));
  79. return (CCTreeControlBarDoc*)m_pDocument;
  80. }
  81. #endif //_DEBUG
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CCTreeControlBarView message handlers
  84. void CCTreeControlBarView::DrawRect(CDC* pDC)
  85. {
  86. CRect rect;
  87. pDC->Rectangle(100,100,400,400);
  88. rect.top=100;
  89. rect.left=100;
  90. rect.right=250;
  91. rect.bottom=250;
  92. pDC->DrawText(m_Title,rect,DT_CENTER);
  93. }
  94. void CCTreeControlBarView::OnInitialUpdate() 
  95. {
  96. CView::OnInitialUpdate();
  97. // TODO: Add your specialized code here and/or call the base class
  98. CCTreeControlBarApp *pApp=(CCTreeControlBarApp *)AfxGetApp();
  99. pApp->pView=this;
  100. }