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

📄 ex050202view.cpp

📁 此功能是在读者指定的坐标点上输出一据话
💻 CPP
字号:
// Ex050202View.cpp : implementation of the CEx050202View class
//

#include "stdafx.h"
#include "Ex050202.h"

#include "Ex050202Doc.h"
#include "Ex050202View.h"
#include "InputDataDlg.h"
#include "MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEx050202View

IMPLEMENT_DYNCREATE(CEx050202View, CView)

BEGIN_MESSAGE_MAP(CEx050202View, CView)
	//{{AFX_MSG_MAP(CEx050202View)
	ON_COMMAND(ID_INPUT_DATA, OnInputData)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CEx050202View construction/destruction

CEx050202View::CEx050202View()
{
	m_iXPos = 0 ;
	m_iYPos = 0 ;
}

CEx050202View::~CEx050202View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CEx050202View drawing

void CEx050202View::OnDraw(CDC* pDC)
{
	CEx050202Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	pDC->TextOut(m_iXPos,m_iYPos,pDoc->i_strData);
}

/////////////////////////////////////////////////////////////////////////////
// CEx050202View printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CEx050202View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CEx050202View message handlers

void CEx050202View::OnInputData() 
{
	CEx050202Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	
	//取得当前值
	CInputDataDlg dlg ;
	dlg.m_strData = pDoc->i_strData ;
	dlg.m_iXPos = m_iXPos ;
	dlg.m_iYPos = m_iYPos ;
	
	CMainFrame * pFrm = (CMainFrame *)theApp.GetMainWnd();
	ASSERT_VALID(pFrm);
	pFrm->OutPutInfoInStatusBar("等待用户输入");
	if(IDOK == dlg.DoModal())
	{
		//根据用户的输入更改内存中的数据
		pDoc->i_strData = dlg.m_strData ;
		m_iXPos = dlg.m_iXPos ;
		m_iYPos = dlg.m_iYPos ;
		Invalidate();//刷新视图
		pFrm->OutPutInfoInStatusBar("用户输入结束");
	}
	else
		pFrm->OutPutInfoInStatusBar("用户取消输入");
}

⌨️ 快捷键说明

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