UseStatusView.cpp
上传用户:yafeite800
上传日期:2020-09-17
资源大小:36k
文件大小:3k
源码类别:

状态条

开发平台:

Visual C++

  1. // UseStatusView.cpp : implementation of the CUseStatusView class
  2. //
  3. #include "stdafx.h"
  4. #include "UseStatus.h"
  5. #include "MainFrm.h"
  6. #include "UseStatusDoc.h"
  7. #include "UseStatusView.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CUseStatusView
  15. IMPLEMENT_DYNCREATE(CUseStatusView, CView)
  16. BEGIN_MESSAGE_MAP(CUseStatusView, CView)
  17. //{{AFX_MSG_MAP(CUseStatusView)
  18. ON_WM_MOUSEMOVE()
  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. // CUseStatusView construction/destruction
  27. CUseStatusView::CUseStatusView()
  28. {
  29. // TODO: add construction code here
  30. }
  31. CUseStatusView::~CUseStatusView()
  32. {
  33. }
  34. BOOL CUseStatusView::PreCreateWindow(CREATESTRUCT& cs)
  35. {
  36. // TODO: Modify the Window class or styles here by modifying
  37. //  the CREATESTRUCT cs
  38. return CView::PreCreateWindow(cs);
  39. }
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CUseStatusView drawing
  42. void CUseStatusView::OnDraw(CDC* pDC)
  43. {
  44. CUseStatusDoc* pDoc = GetDocument();
  45. ASSERT_VALID(pDoc);
  46. // TODO: add draw code for native data here
  47. }
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CUseStatusView printing
  50. BOOL CUseStatusView::OnPreparePrinting(CPrintInfo* pInfo)
  51. {
  52. // default preparation
  53. return DoPreparePrinting(pInfo);
  54. }
  55. void CUseStatusView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  56. {
  57. // TODO: add extra initialization before printing
  58. }
  59. void CUseStatusView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  60. {
  61. // TODO: add cleanup after printing
  62. }
  63. /////////////////////////////////////////////////////////////////////////////
  64. // CUseStatusView diagnostics
  65. #ifdef _DEBUG
  66. void CUseStatusView::AssertValid() const
  67. {
  68. CView::AssertValid();
  69. }
  70. void CUseStatusView::Dump(CDumpContext& dc) const
  71. {
  72. CView::Dump(dc);
  73. }
  74. CUseStatusDoc* CUseStatusView::GetDocument() // non-debug version is inline
  75. {
  76. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CUseStatusDoc)));
  77. return (CUseStatusDoc*)m_pDocument;
  78. }
  79. #endif //_DEBUG
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CUseStatusView message handlers
  82. void CUseStatusView::OnMouseMove(UINT nFlags, CPoint point) 
  83. {
  84. CString str ;
  85. CMainFrame* pF = (CMainFrame*)AfxGetApp()->m_pMainWnd;
  86. CStatusBar* pS = &pF->m_wndStatusBar;
  87. if(pS)
  88. {
  89. str.Format("x : %d ; y : %d",point.x,point.y);
  90. pS->SetPaneText(0,str);
  91. }
  92. }