📄 myfiledlg.cpp
字号:
// MyFileDlg.cpp : implementation file
//
#include "stdafx.h"
#include "FileDlg.h"
#include "MyFileDlg.h"
#include <dlgs.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyFileDlg
IMPLEMENT_DYNAMIC(CMyFileDlg, CFileDialog)
CMyFileDlg::CMyFileDlg(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
}
BEGIN_MESSAGE_MAP(CMyFileDlg, CFileDialog)
//{{AFX_MSG_MAP(CMyFileDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CMyFileDlg::OnInitDialog()
{
//对话框高150象素,该变量根据对话框大小改变
const UINT iExtraSize = 150;
// 对话框中控件数
const UINT nControls = 7;
// 过去指向对话框的指针
CWnd *wndDlg = GetParent();
RECT Rect;
wndDlg->GetWindowRect(&Rect);
//改变对话框大小
wndDlg->SetWindowPos(NULL, 0, 0,
Rect.right - Rect.left,
Rect.bottom - Rect.top + iExtraSize,
SWP_NOMOVE);
// 控件ID,在 <dlgs.h>中定义
UINT Controls[nControls] = {stc3, stc2, // The two label controls
edt1, cmb1, // The eidt control and the drop-down box
IDOK, IDCANCEL,
lst1}; // Explorer vinduet
// 确定每个控件的位置
for (int i=0 ; i<nControls ; i++)
{
CWnd *wndCtrl = wndDlg->GetDlgItem(Controls[i]);
wndCtrl->GetWindowRect(&Rect);
wndDlg->ScreenToClient(&Rect);
// 按照对话框大小,确定每个控件位置
if (Controls[i] != lst1)
wndCtrl->SetWindowPos(NULL,
Rect.left, Rect.top + iExtraSize,
0, 0, SWP_NOSIZE);
else
wndCtrl->SetWindowPos(NULL, 0, 0,
Rect.right - Rect.left,
Rect.bottom - Rect.top + iExtraSize,
SWP_NOMOVE);
}
//调用基类函数OnInitDialog
CFileDialog::OnInitDialog();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -