?? cftdlg.cpp
字號:
// 自定義格式化文本代碼
// 作者: Janhail Luo
// 最后整理: 2003-03-03
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "CFT.h"
#include "CFTDlg.h"
#include "CFTAnalyser.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCFTDlg dialog
CCFTDlg::CCFTDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCFTDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCFTDlg)
m_String = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CCFTDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCFTDlg)
DDX_Text(pDX, IDC_EDIT1, m_String);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCFTDlg, CDialog)
//{{AFX_MSG_MAP(CCFTDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDCLOSE, OnClose)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCFTDlg message handlers
BOOL CCFTDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
this->m_String =
"<font size = 16>\r\n"
" <font color=red>\r\n"
" Red\r\n"
" </font>\r\n"
" <i>\r\n"
" and\r\n"
" </i>\r\n"
" <font color= blue>\r\n"
" Blue\r\n"
" </font>\r\n"
" <font size= 30>\r\n"
" Size = [\r\n"
" <b>\r\n"
" 30\r\n"
" < /b >\r\n"
" ]\r\n"
" </font>\r\n"
"</font>\r\n";
this->UpdateData(FALSE);
this->OnButton1();
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CCFTDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPaintDC dc(this); // device context for painting
dc.Rectangle(11, 10, 527, 100);
this->OnDraw(dc, 13, 12);
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CCFTDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CCFTDlg::OnClose()
{
this->DestroyWindow();
}
void CCFTDlg::OnDraw(CPaintDC& dc, int iX, int iY)
{
m_CFT.SetStartPos(13, 13);
m_CFT.Visitor(1, &dc);
}
void CCFTDlg::OnButton1()
{
this->UpdateData();
m_CFT.Init(this->m_String, "test");
this->Invalidate();
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -