SkinSDISampleView.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:3k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // SkinSDISampleView.cpp : implementation of the CSkinSDISampleView class
  2. //
  3. #include "stdafx.h"
  4. #include "SkinSDISample.h"
  5. #include "SkinSDISampleDoc.h"
  6. #include "CntrItem.h"
  7. #include "SkinSDISampleView.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CSkinSDISampleView
  15. IMPLEMENT_DYNCREATE(CSkinSDISampleView, CRichEditView)
  16. BEGIN_MESSAGE_MAP(CSkinSDISampleView, CRichEditView)
  17. //{{AFX_MSG_MAP(CSkinSDISampleView)
  18. ON_WM_DESTROY()
  19. ON_WM_CREATE()
  20. //}}AFX_MSG_MAP
  21. // Standard printing commands
  22. ON_COMMAND(ID_FILE_PRINT, CRichEditView::OnFilePrint)
  23. ON_COMMAND(ID_FILE_PRINT_DIRECT, CRichEditView::OnFilePrint)
  24. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRichEditView::OnFilePrintPreview)
  25. END_MESSAGE_MAP()
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CSkinSDISampleView construction/destruction
  28. CSkinSDISampleView::CSkinSDISampleView()
  29. {
  30. // TODO: add construction code here
  31. }
  32. CSkinSDISampleView::~CSkinSDISampleView()
  33. {
  34. }
  35. BOOL CSkinSDISampleView::PreCreateWindow(CREATESTRUCT& cs)
  36. {
  37. // TODO: Modify the Window class or styles here by modifying
  38. //  the CREATESTRUCT cs
  39. return CRichEditView::PreCreateWindow(cs);
  40. }
  41. void CSkinSDISampleView::OnInitialUpdate()
  42. {
  43. CRichEditView::OnInitialUpdate();
  44. // Set the printing margins (720 twips = 1/2 inch).
  45. SetMargins(CRect(720, 720, 720, 720));
  46. static BOOL bFirstRun = TRUE;
  47. if (bFirstRun)
  48. {
  49. for (int i = 0; i < 50; i++)
  50. {
  51. CString str;
  52. str.Format(_T("Line %in"), i);
  53. GetRichEditCtrl().ReplaceSel(str);
  54. }
  55. bFirstRun = FALSE;
  56. }
  57. }
  58. /////////////////////////////////////////////////////////////////////////////
  59. // CSkinSDISampleView printing
  60. BOOL CSkinSDISampleView::OnPreparePrinting(CPrintInfo* pInfo)
  61. {
  62. // default preparation
  63. return DoPreparePrinting(pInfo);
  64. }
  65. void CSkinSDISampleView::OnDestroy()
  66. {
  67. CRichEditView::OnDestroy();
  68. }
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CSkinSDISampleView diagnostics
  71. #ifdef _DEBUG
  72. void CSkinSDISampleView::AssertValid() const
  73. {
  74. CRichEditView::AssertValid();
  75. }
  76. void CSkinSDISampleView::Dump(CDumpContext& dc) const
  77. {
  78. CRichEditView::Dump(dc);
  79. }
  80. CSkinSDISampleDoc* CSkinSDISampleView::GetDocument() // non-debug version is inline
  81. {
  82. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSkinSDISampleDoc)));
  83. return (CSkinSDISampleDoc*)m_pDocument;
  84. }
  85. #endif //_DEBUG
  86. /////////////////////////////////////////////////////////////////////////////
  87. // CSkinSDISampleView message handlers
  88. int CSkinSDISampleView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  89. {
  90. if (CRichEditView::OnCreate(lpCreateStruct) == -1)
  91. return -1;
  92. // TODO: Add your specialized creation code here
  93. return 0;
  94. }