📄 wzddlg.cpp
字号:
// WzdDlg.cpp : implementation file
//
#include "stdafx.h"
#include "wzd.h"
#include "WzdDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWzdDialog dialog
CWzdDialog::CWzdDialog(CWnd* pParent /*=NULL*/)
: CDialog(CWzdDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CWzdDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_bToggleSize=FALSE;
}
void CWzdDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWzdDialog)
DDX_Control(pDX, IDC_MORE_BUTTON, m_ctrlMoreButton);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CWzdDialog, CDialog)
//{{AFX_MSG_MAP(CWzdDialog)
ON_BN_CLICKED(IDC_MORE_BUTTON, OnMoreButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWzdDialog message handlers
BOOL CWzdDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// save our full size
GetWindowRect(&m_rectFull);
m_rectHalf=m_rectFull;
// calculate our half size based on bottom of "More" button
CRect rect;
m_ctrlMoreButton.GetWindowRect(&rect);
m_rectHalf.bottom=rect.bottom+10; // + 10 for cosmetics
// toggle window size
ToggleSize();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CWzdDialog::OnMoreButton()
{
ToggleSize();
}
void CWzdDialog::ToggleSize()
{
CRect rect;
CString str;
if (m_bToggleSize)
{
str="<< &Less";
rect=m_rectFull;
}
else
{
str="&More >>";
rect=m_rectHalf;
}
SetWindowPos(NULL,0,0,rect.Width(),rect.Height(),SWP_NOZORDER|SWP_NOMOVE);
m_ctrlMoreButton.SetWindowText(str);
m_bToggleSize=!m_bToggleSize;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -