📄 paragraphdialog.cpp
字号:
// ParagraphDialog.cpp : implementation file
//
#include "stdafx.h"
#include "Edit.h"
#include "ParagraphDialog.h"
#include <limits.h>
#define DDXM_BLANK INT_MAX
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CParagraphDialog dialog
CParagraphDialog::CParagraphDialog(PARAFORMAT &pf, CWnd* pParent /*=NULL*/)
: CDialog(CParagraphDialog::IDD, pParent)
{
m_pf = pf;
if (m_pf.dwMask & PFM_ALIGNMENT)
{
if (m_pf.wAlignment & PFA_LEFT && m_pf.wAlignment & PFA_RIGHT)
m_nAlignment = 2;
else
m_nAlignment = (m_pf.wAlignment & PFA_LEFT) ? 0 : 1;
}
else
m_nAlignment = -1;
//{{AFX_DATA_INIT(CParagraphDialog)
m_nFirst = 0;
m_nLeft = 0;
m_nRight = 0;
//}}AFX_DATA_INIT
}
void CParagraphDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CParagraphDialog)
DDX_CBIndex(pDX, IDC_COMBO_ALIGNMENT, m_nAlignment);
DDX_Text(pDX, IDC_INDENT_LEFT, m_nLeft);
DDV_MinMaxDouble(pDX, m_nLeft, -31680, 31680);
DDX_Text(pDX, IDC_INDENT_RIGHT, m_nRight);
DDV_MinMaxDouble(pDX, m_nRight, -31680, 31680);
DDX_Text(pDX, IDC_INDENT_FIRST, m_nFirst);
DDV_MinMaxDouble(pDX, m_nFirst, -31680, 31680);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CParagraphDialog, CDialog)
//{{AFX_MSG_MAP(CParagraphDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CParagraphDialog message handlers
BOOL CParagraphDialog::OnInitDialog()
{
CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_COMBO_ALIGNMENT);
CString str;
str.LoadString(IDS_LEFT);
pBox->AddString(str);
str.LoadString(IDS_RIGHT);
pBox->AddString(str);
str.LoadString(IDS_CENTER);
pBox->AddString(str);
m_nRight = (m_pf.dwMask & PFM_RIGHTINDENT) ? m_pf.dxRightIndent : DDXM_BLANK;
if (m_pf.dwMask & PFM_OFFSET)
{
m_nFirst = -m_pf.dxOffset;
m_nLeft = (m_pf.dwMask & PFM_STARTINDENT) ?
m_pf.dxStartIndent + m_pf.dxOffset : DDXM_BLANK;
}
else
m_nLeft = m_nFirst = DDXM_BLANK;
CDialog::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CParagraphDialog::OnOK()
{
CDialog::OnOK();
m_pf.dwMask = 0;
if (m_nAlignment >= 0)
{
ASSERT(m_nAlignment < 3);
m_pf.dwMask |= PFM_ALIGNMENT;
m_pf.wAlignment = (WORD)((m_nAlignment == 0) ? PFA_LEFT :
(m_nAlignment == 1) ? PFA_RIGHT : PFA_CENTER);
}
if (m_nRight != DDXM_BLANK)
m_pf.dwMask |= PFM_RIGHTINDENT;
if (m_nLeft != DDXM_BLANK && m_nFirst != DDXM_BLANK)
m_pf.dwMask |= PFM_STARTINDENT;
if (m_nFirst != DDXM_BLANK)
m_pf.dwMask |= PFM_OFFSET;
m_pf.dxRightIndent = m_nRight;
m_pf.dxOffset = -m_nFirst;
m_pf.dxStartIndent = m_nLeft + m_nFirst;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -