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

📄 fycview.cpp

📁 可以自行设置字体的文本编辑器!另外可以进行文本编辑、读取保存
💻 CPP
字号:
// fycView.cpp : implementation of the CFycView class
//

#include "stdafx.h"
#include "fyc.h"

#include "fycDoc.h"
#include "fycView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
LOGFONT NEAR CFycView::m_logfont;
/////////////////////////////////////////////////////////////////////////////
// CFycView

IMPLEMENT_DYNCREATE(CFycView, CEditView)

BEGIN_MESSAGE_MAP(CFycView, CEditView)
	//{{AFX_MSG_MAP(CFycView)
	ON_COMMAND(ID_FORM_FONT, OnFormFont)
	ON_WM_CREATE()
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CFycView construction/destruction

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

}

CFycView::~CFycView()
{
}

BOOL CFycView::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;
}

/////////////////////////////////////////////////////////////////////////////
// CFycView drawing

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

/////////////////////////////////////////////////////////////////////////////
// CFycView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CFycView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CFycView message handlers

void CFycView::OnFormFont() 
{
	// TODO: Add your command handler code here
	CClientDC dc(this);
	
	LOGFONT lf;
	lf=m_logfont;
	CFontDialog dlg(&lf, CF_SCREENFONTS|CF_INITTOLOGFONTSTRUCT);
	if (dlg.DoModal()==IDOK) 
	{
		m_logfont=lf;
		m_font.DeleteObject();
		m_font.CreateFontIndirect(&m_logfont);
	    SetFont(&m_font);
	}
	
}

int CFycView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CEditView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	m_logfont.lfHeight = 12;
	lstrcpy(m_logfont.lfFaceName, "宋体");
	m_logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
	m_logfont.lfQuality = PROOF_QUALITY;
	m_logfont.lfOutPrecision = OUT_TT_PRECIS;
	m_logfont.lfPitchAndFamily = FF_SWISS | VARIABLE_PITCH;
	m_font.CreateFontIndirect(&m_logfont);
	SetFont(&m_font);
	
	return 0;
}

⌨️ 快捷键说明

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