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

📄 textview.cpp

📁 Visual C++应用教程-源代码 本书在复习C++基础知识后
💻 CPP
字号:
// TextView.cpp : implementation file
//

#include "stdafx.h"
#include "Ex_Form.h"
#include "TextView.h"
#include "Ex_FormDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTextView

IMPLEMENT_DYNCREATE(CTextView, CFormView)

CTextView::CTextView()
	: CFormView(CTextView::IDD)
{
	//{{AFX_DATA_INIT(CTextView)
	m_strText = _T("");
	//}}AFX_DATA_INIT
}

CTextView::~CTextView()
{
}

void CTextView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTextView)
	DDX_Text(pDX, IDC_EDIT1, m_strText);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTextView, CFormView)
	//{{AFX_MSG_MAP(CTextView)
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTextView diagnostics

#ifdef _DEBUG
void CTextView::AssertValid() const
{
	CFormView::AssertValid();
}

void CTextView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTextView message handlers

void CTextView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	CEx_FormDoc* pDoc = (CEx_FormDoc*)GetDocument();
	m_strText = pDoc->m_strContent;
	UpdateData(FALSE);	
}

void CTextView::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	CWnd* pWnd = GetDlgItem(IDC_EDIT1);		// 获取编辑框窗口指针
	if (pWnd)		// 若窗口指针有效
		pWnd->SetWindowPos( NULL,0,0,cx,cy,SWP_NOZORDER);
	
}

⌨️ 快捷键说明

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