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

📄 ex1001view.cpp

📁 vc++例子 学习过程中制作 对话框 按纽 编程实例
💻 CPP
字号:
// Ex1001View.cpp : implementation of the CEx1001View class
//

#include "stdafx.h"
#include "Ex1001.h"
#include "ExchangDialog.h"
#include "Ex1001Doc.h"
#include "Ex1001View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CEx1001View

IMPLEMENT_DYNCREATE(CEx1001View, CView)

BEGIN_MESSAGE_MAP(CEx1001View, CView)
	//{{AFX_MSG_MAP(CEx1001View)
	ON_COMMAND(ID_SHOWTEXT, OnShowtext)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CEx1001View construction/destruction

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

}

CEx1001View::~CEx1001View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CEx1001View drawing

void CEx1001View::OnDraw(CDC* pDC)
{
	CEx1001Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDC->TextOut(pDoc->m_xpos,pDoc->m_ypos,pDoc->m_Text);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CEx1001View printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CEx1001View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CEx1001View message handlers

void CEx1001View::OnShowtext() 
{
	// TODO: Add your command handler code here
CEx1001Doc* pDoc=GetDocument();
ASSERT_VALID(pDoc);
CExchangDialog  dlg;
dlg.m_ShowString="Please input the string";
if(dlg.DoModal()!=IDOK)
  return;
else
{  
	pDoc->m_Text=dlg.m_ShowString;
	if((dlg.m_xPosition>=0 && dlg.m_xPosition<=200)&&(dlg.m_yPosition>=0 && dlg.m_yPosition<=200))

	{
		pDoc->m_xpos=dlg.m_xPosition;
        pDoc->m_ypos=dlg.m_yPosition;
	}  
            Invalidate();
}	
}

⌨️ 快捷键说明

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