📄 fileselectiondlg.cpp
字号:
#include "stdafx.h"
#include "plxc.h"
#include "FileSelectionDlg.h"
#include "FolderDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CFileSelectionDlg::CFileSelectionDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFileSelectionDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFileSelectionDlg)
//}}AFX_DATA_INIT
}
void CFileSelectionDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFileSelectionDlg)
DDX_Control(pDX, IDC_FILESTYLE_LIST, m_fileStyle);
DDX_Control(pDX, IDC_FILENAMEEDIT, m_fileName);
DDX_Control(pDX, IDC_FILEPATHEDIT, m_filePath);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFileSelectionDlg, CDialog)
//{{AFX_MSG_MAP(CFileSelectionDlg)
ON_BN_CLICKED(IDC_PATHSELECT_BTN, OnPathselectBtn)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CFileSelectionDlg::OnPathselectBtn()
{
CFolderDialog folderSelect(_T("Select a folder!"));
if(folderSelect.DoModal() != IDOK)
{
return;
}
m_filePath.SetWindowText(folderSelect.GetFolderPath());
}
BOOL CFileSelectionDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_fileStyle.AddString(_T("Plx Source file"));
m_fileStyle.AddString(_T(""));
return TRUE;
}
void CFileSelectionDlg::OnOK()
{
CString strFileName;
CString strFilePath;
m_fileName.GetWindowText(strFileName);
m_filePath.GetWindowText(strFilePath);
if(strFileName.IsEmpty() || strFilePath.IsEmpty())
{
AfxMessageBox(_T("File name or path is empty!"));
return;
}
if(strFilePath.Right(1) != '\\')
{
strFilePath += '\\';
}
strFilePath += strFileName;
if(strFileName.Right(4) != _T(".plx"))
{
strFilePath += _T(".plx");
}
m_strFilePath = strFilePath;
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -