📄 myfiledialog.cpp
字号:
// MyFileDialog.cpp : implementation file
//
#include "stdafx.h"
#include "MixedCS.h"
#include "MyFileDialog.h"
#include <dlgs.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyFileDialog
IMPLEMENT_DYNAMIC(CMyFileDialog, CFileDialog)
CMyFileDialog::CMyFileDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
}
BEGIN_MESSAGE_MAP(CMyFileDialog, CFileDialog)
//{{AFX_MSG_MAP(CMyFileDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CMyFileDialog::OnInitDialog()
{
CFileDialog::OnInitDialog();
// TODO: Add extra initialization here
// This variable should be changed acording to your wishes
// about the size of the finished dialog
const UINT iExtraSize = 80;
// Number of controls in the File Dialog
const UINT nControls = 7;
// Get a pointer to the original dialog box.
CWnd *wndDlg = GetParent();
RECT Rect;
wndDlg->GetWindowRect(&Rect);
// Change the size
wndDlg->SetWindowPos(NULL, 0, 0,
Rect.right - Rect.left,
Rect.bottom - Rect.top + iExtraSize,
SWP_NOMOVE);
// Control ID's - defined in <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
// Go through each of the controls in the dialog box, and move them to a new position
for(int i=0; i<nControls; ++i)
{
CWnd *wndCtrl = wndDlg->GetDlgItem(Controls[i]);
wndCtrl->GetWindowRect(&Rect);
wndDlg->ScreenToClient(&Rect); // Remember it is child controls
// Move all the controls according to the new size of the dialog.
if (Controls[i] != lst1)
wndCtrl->SetWindowPos(NULL,
Rect.left, Rect.top + iExtraSize,
0, 0, SWP_NOSIZE);
else // This is the explorer like window. It should be sized - not moved.
wndCtrl->SetWindowPos(NULL, 0, 0,
Rect.right - Rect.left,
Rect.bottom - Rect.top + iExtraSize,
SWP_NOMOVE);
}
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 + -