📄 aboutdlalog.cpp
字号:
// AboutDlalog.cpp : implementation file
//重庆大学软件学院2002级3班 靳国荣
#include "stdafx.h"
#include "Familytree.h"
#include "FamilytreeDlg.h"
#include "AboutDlalog.h"
#include <dos.h>
#include <direct.h>
#include "SinusFrame.h"
#include "hyperLink.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlalog dialog
CAboutDlalog::CAboutDlalog(CWnd* pParent /*=NULL*/)
: CDialog(CAboutDlalog::IDD, pParent)
{
//{{AFX_DATA_INIT(CAboutDlalog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CAboutDlalog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlalog)
// NOTE: the ClassWizard will add DDX and DDV calls here
DDX_Control(pDX, IDC_STATIC_SINUS, m_ctrlSinus);
DDX_Control(pDX, IDC_LABEL_MAILTO, m_MailTo);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlalog, CDialog)
//{{AFX_MSG_MAP(CAboutDlalog)
ON_BN_CLICKED(IDC_EXPAND, OnExpand)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAboutDlalog message handlers
BOOL CAboutDlalog::OnInitDialog()
{
CDialog::OnInitDialog(); // CG: This was added by System Info Component.
CString m_strText;
//在图片控件显示
VERIFY(m_font.CreatePointFont(220, "宋体"));
m_strText = "________数据结构课程设计****欢迎使用!***靳国荣__2004年05月至6月于重庆大学软件学院________"
"指导老师——陈林————"
"If you have any questions, write to "
"jgr8224@sina.com,thank you!";
m_ctrlSinus.SetText(m_strText);
m_ctrlSinus.SetFont(&m_font);
m_ctrlSinus.SetSinusSpeed(6);
m_ctrlSinus.Start();
UpdateData(false);
//发邮件:
m_MailTo.SetURL(_T("mailto:jgr8224@sina.com"));
m_MailTo.SetUnderline(FALSE);
CString str;
// 填写计算机信息
MEMORYSTATUS MemStat;
MemStat.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&MemStat);
// 总的物理内存
str.Format( _T("%lu KB"), MemStat.dwTotalPhys / 1024L);
SetDlgItemText(IDC_PHYSICAL_MEM, str);
TCHAR szWindowsPath[_MAX_PATH];
GetWindowsDirectory(szWindowsPath, _MAX_PATH);
ULARGE_INTEGER TotalNumberOfBytes, TotalNumberOfFreeBytes;
GetDiskFreeSpaceEx((LPSTR)szWindowsPath,
NULL,
&TotalNumberOfBytes,
&TotalNumberOfFreeBytes);
// 可用的硬盘空间
str.Format(_T("%lu KB"), TotalNumberOfFreeBytes.QuadPart / 1024L);
SetDlgItemText(IDC_DISK_SPACE, str);
//按钮
m_btnOk.SubclassDlgItem(IDOK, this);
m_btnOk.SetIcon(IDI_ICON22);
m_btnOnexpand.SubclassDlgItem(IDC_EXPAND, this);
m_btnOnexpand.SetIcon(IDI_ICON24);
//扩展
ExtendDlg(IDC_SEPARATE,FALSE);
return TRUE;
}
void CAboutDlalog::OnExpand()
{
// TODO: Add your control notification handler code here
static BOOL bExpand=TRUE;
ExtendDlg(IDC_SEPARATE,bExpand);
bExpand=!bExpand;
}
void CAboutDlalog::EnableVisibleChildren()
{
// 下面的代码使不在当前对话框中的按钮失效。
// 这样可以避免使用Tab键或者快捷键移动到隐藏的控件
// 得到第一个子控件
CWnd* pWndCtrl=GetWindow(GW_CHILD);
CRect rcRest;
CRect rcControl;
CRect rcShow;
GetWindowRect(rcShow);
// 遍历对话框中的控件
while(pWndCtrl!=NULL)
{
pWndCtrl->GetWindowRect(rcControl);
if(rcRest.IntersectRect(rcShow,rcControl))
pWndCtrl->EnableWindow(TRUE);
else
pWndCtrl->EnableWindow(FALSE);
// 得到在控件组中的下一个
pWndCtrl=pWndCtrl->GetWindow(GW_HWNDNEXT);
}
}
void CAboutDlalog::ExtendDlg(int nResourceID, BOOL bExpand)
{
// 如果bExpand==TRUE,则扩展对话框为最大;
// 否则缩小对话框,新的对话框的底部为资源nResourceID控件分割
static CRect rcLarge;
static CRect rcSmall;
CString sExpand;
// 在开始时,保存对话框的最大和最小尺寸
if(rcLarge.IsRectNull())
{
CRect rcLandmark;
// 得到分割条的指针
CWnd* pWndLandmark=GetDlgItem(nResourceID);
ASSERT(pWndLandmark);
// 得到对话框的尺寸
GetWindowRect(rcLarge);
// 得到分割条在对话框中的位置
pWndLandmark->GetWindowRect(rcLandmark);
rcSmall=rcLarge;
rcSmall.bottom=rcLandmark.top;
}
if(bExpand)
{
// 扩展对话框:重新设置对话框到其原始(最大)尺寸(rcLarge)
SetWindowPos(NULL,0,0,rcLarge.Width(),rcLarge.Height(),
SWP_NOMOVE|SWP_NOZORDER);
sExpand="<<收缩";
EnableVisibleChildren();
}
else
{
// 缩小对话框:重新设置对话框到其最小尺寸(rcSmall)
SetWindowPos(NULL,0,0,rcSmall.Width(),rcSmall.Height(),
SWP_NOMOVE|SWP_NOZORDER);
sExpand="扩展>>";
EnableVisibleChildren();
}
// 设置按钮的文字
SetDlgItemText(IDC_EXPAND,sExpand);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -