⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e1view.cpp

📁 基于视图类的VC练习小程序
💻 CPP
字号:
// E1View.cpp : implementation of the CE1View class
//

#include "stdafx.h"
#include "E1.h"

#include "E1Doc.h"
#include "E1View.h"
#include "E1Dialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CE1View

IMPLEMENT_DYNCREATE(CE1View, CView)

BEGIN_MESSAGE_MAP(CE1View, CView)
	//{{AFX_MSG_MAP(CE1View)
	ON_COMMAND(ID_VIEW_INPUTDIALOG, OnViewInputdialog)
	//}}AFX_MSG_MAP
	// 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)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CE1View construction/destruction

CE1View::CE1View()
{
	// TODO: add construction code here

}

CE1View::~CE1View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CE1View drawing

void CE1View::OnDraw(CDC* pDC)
{
	CE1Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDC->TextOut(102,100,'i');
    pDC->TextOut(108,100,'n');
	pDC->TextOut(116,100,'p');
    pDC->TextOut(124,100,'u');
    pDC->TextOut(132,100,'t');
    pDC->TextOut(140,100,':');
//	CE1Dialog E;	
//	if (E.DoModal()==IDOK)
//	{   }
//	char y,m_strInput;
//	y=m_strInput;
//   pDC->TextOut(132,10,'y');

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

/////////////////////////////////////////////////////////////////////////////
// CE1View printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CE1View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CE1View message handlers

void CE1View::OnViewInputdialog() 
{
	// TODO: Add your command handler code here
   CE1Dialog E;	
	if (E.DoModal()==IDOK)
	{
		CString m=E.m_strInput;
	    CClientDC dc(this);
	  dc.TextOut(140,120,m);
	}
}

BOOL CE1View::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CView::OnCommand(wParam, lParam);
}

⌨️ 快捷键说明

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