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

📄 dialogdoc.cpp

📁 示例对话框应用程序,设置格式菜单,改变窗口中文字的字形与颜色
💻 CPP
字号:
// DialogDoc.cpp : implementation of the CDialogDoc class
//

#include "stdafx.h"
#include "Dialog.h"

#include "DialogDoc.h"
#include "Format.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDialogDoc

IMPLEMENT_DYNCREATE(CDialogDoc, CDocument)

BEGIN_MESSAGE_MAP(CDialogDoc, CDocument)
	//{{AFX_MSG_MAP(CDialogDoc)
	ON_COMMAND(ID_FORMAT, OnFormat)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDialogDoc construction/destruction

CDialogDoc::CDialogDoc()
{
	// TODO: add one-time construction code here
    m_bold=false;
	m_italic=false;
	m_underline=false;
	m_color=-1;
}

CDialogDoc::~CDialogDoc()
{
}

BOOL CDialogDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CDialogDoc serialization

void CDialogDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CDialogDoc diagnostics

#ifdef _DEBUG
void CDialogDoc::AssertValid() const
{
	CDocument::AssertValid();
}

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

/////////////////////////////////////////////////////////////////////////////
// CDialogDoc commands

void CDialogDoc::OnFormat() 
{
	// TODO: Add your command handler code here
	Format dlg;
	//设置控件的的初始状态
	dlg.m_bold=m_bold;
	dlg.m_italic=m_italic;
	dlg.m_underline=m_underline;
	dlg.m_color=m_color;
	//显示对话框,并取得用户选择
	if(dlg.DoModal()==IDOK)
	{
		m_bold=dlg.m_bold;
		m_underline=dlg.m_underline;
		m_italic=dlg.m_italic;
		m_color=dlg.m_color;
		UpdateAllViews(NULL);
	}
}

⌨️ 快捷键说明

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