📄 aboutdlg.cpp
字号:
// AboutDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "AboutDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog
CAboutDlg::CAboutDlg(bool *ptr,CWnd* pParent /*=NULL*/)
: CDialog(CAboutDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAboutDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_Ptr=ptr;
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_WM_CANCELMODE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg message handlers
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
ArrangeItems();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CAboutDlg::ArrangeItems()
{
CStatic *stc;
CString str;
CDC *pdc;
CRect rt;
int h;
UINT uidStc[5]={IDC_STR_ABOUT1,IDC_STR_ABOUT2,IDC_STR_ABOUT3,IDC_STR_ABOUT4,IDC_STR_ABOUT5};
UINT uidStr[5]={IDS_ABOUT1,IDS_ABOUT2,IDS_ABOUT3,IDS_ABOUT4,IDS_ABOUT5};
for (int i=0;i<5;i++){
stc=(CStatic *)GetDlgItem(uidStc[i]);
str.LoadString(uidStr[i]);
if (stc){
CSize sz;
int n;
stc->SetWindowText(str);
stc->GetWindowRect(&rt);
n=rt.Height();
if (i>0){
rt.top=h;
rt.bottom=rt.top+n;
}
rt.left=8;
rt.right=232;
pdc=stc->GetDC();
sz=pdc->GetTextExtent(str);
if (sz.cx>rt.Width()){
int i;
i=sz.cx/rt.Width()+((sz.cx%rt.Width()>0)?1:0);
rt.bottom=rt.top+sz.cy*i;
}
if (i==0)
ScreenToClient(&rt);
stc->MoveWindow(&rt);
stc->ReleaseDC(pdc);
h=rt.bottom+6;
stc->Invalidate();
}
}
}
void CAboutDlg::OnCancelMode()
{
CDialog::OnCancelMode();
// TODO: Add your message handler code here
*m_Ptr=false;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -