sdimenusview.cpp

来自「Visual_C++[1].NET_Bible1 Visual_C++宝典书中」· C++ 代码 · 共 117 行

CPP
117
字号
// SDIMenusView.cpp : implementation of the CSDIMenusView class
//

#include "stdafx.h"
#include "SDIMenus.h"

#include "SDIMenusDoc.h"
#include "SDIMenusView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CSDIMenusView

IMPLEMENT_DYNCREATE(CSDIMenusView, CView)

BEGIN_MESSAGE_MAP(CSDIMenusView, CView)
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  ON_COMMAND(ID_SPEAK_BEFORMAL, OnSpeakBeformal)
  ON_UPDATE_COMMAND_UI(ID_SPEAK_BEFORMAL, OnUpdateSpeakBeformal)
  ON_COMMAND(ID_SPEAK_SAYHELLO, OnSpeakSayhello)
END_MESSAGE_MAP()

// CSDIMenusView construction/destruction

CSDIMenusView::CSDIMenusView()
{
  m_bFormal = FALSE;
}

CSDIMenusView::~CSDIMenusView()
{
}

BOOL CSDIMenusView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

// CSDIMenusView drawing

void CSDIMenusView::OnDraw(CDC* /*pDC*/)
{
	CSDIMenusDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// TODO: add draw code for native data here
}


// CSDIMenusView printing

BOOL CSDIMenusView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CSDIMenusView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CSDIMenusView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}


// CSDIMenusView diagnostics

#ifdef _DEBUG
void CSDIMenusView::AssertValid() const
{
	CView::AssertValid();
}

void CSDIMenusView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CSDIMenusDoc* CSDIMenusView::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSDIMenusDoc)));
	return (CSDIMenusDoc*)m_pDocument;
}
#endif //_DEBUG


// CSDIMenusView message handlers

void CSDIMenusView::OnSpeakBeformal()
{
  m_bFormal = !m_bFormal;
}

void CSDIMenusView::OnUpdateSpeakBeformal(CCmdUI *pCmdUI)
{
  pCmdUI->SetCheck(m_bFormal);
}

void CSDIMenusView::OnSpeakSayhello()
{
  CString str;
  str.Format("Hello%s!", m_bFormal ? ", sir" : "");
  AfxMessageBox(str);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?