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

📄 editvview.cpp

📁 这些源代码
💻 CPP
字号:
// EditVView.cpp : implementation of the CEditVView class
//

#include "stdafx.h"
#include "EditV.h"

#include "EditVDoc.h"
#include "EditVView.h"
#include	"MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEditVView

IMPLEMENT_DYNCREATE(CEditVView, CEditView)

BEGIN_MESSAGE_MAP(CEditVView, CEditView)
	//{{AFX_MSG_MAP(CEditVView)
	ON_WM_CHAR()
	ON_WM_KEYDOWN()
	ON_CONTROL_REFLECT(EN_SETFOCUS, OnSetfocus)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEditVView construction/destruction

CEditVView::CEditVView()
{
	m_bOverstrike = false;
}

CEditVView::~CEditVView()
{
}

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

	BOOL bPreCreated = CEditView::PreCreateWindow(cs);
	cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL);	// Enable word-wrapping

	return bPreCreated;
}

/////////////////////////////////////////////////////////////////////////////
// CEditVView drawing

void CEditVView::OnDraw(CDC* pDC)
{
	CEditVDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CEditVView printing

BOOL CEditVView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default CEditView preparation
	return CEditView::OnPreparePrinting(pInfo);
}

void CEditVView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	// Default CEditView begin printing.
	CEditView::OnBeginPrinting(pDC, pInfo);
}

void CEditVView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	// Default CEditView end printing
	CEditView::OnEndPrinting(pDC, pInfo);
}

/////////////////////////////////////////////////////////////////////////////
// CEditVView diagnostics

#ifdef _DEBUG
void CEditVView::AssertValid() const
{
	CEditView::AssertValid();
}

void CEditVView::Dump(CDumpContext& dc) const
{
	CEditView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CEditVView message handlers

void CEditVView::OnInitialUpdate() 
{
	CEditView::OnInitialUpdate();
	m_Font.CreatePointFont (120, "Comic Sans MS");
	SetFont (&m_Font);
	// TODO: Add your specialized code here and/or call the base class
}

void CEditVView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default
	if (m_bOverstrike && (nChar >= ' '))
	{
		int nStart, nEnd;
		GetEditCtrl().GetSel (nStart, nEnd);
		if (nStart == nEnd)
			GetEditCtrl().SetSel (nStart, nStart +1);
	}
	CEditView::OnChar(nChar, nRepCnt, nFlags);
}

void CEditVView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default
	CEditView::OnKeyDown(nChar, nRepCnt, nFlags);
	if (nChar == VK_INSERT)
	{
		m_bOverstrike = !m_bOverstrike;
		CMainFrame *frame = (CMainFrame *) AfxGetApp()->GetMainWnd();
		frame->SetOverstrike (m_bOverstrike);
	}
}

void CEditVView::OnSetfocus() 
{
	// TODO: Add your control notification handler code here
	CMainFrame *frame = (CMainFrame *) AfxGetApp()->GetMainWnd();
	frame->SetOverstrike (m_bOverstrike);
}

⌨️ 快捷键说明

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