📄 pc_browserdlg.cpp
字号:
// PC_BrowserDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DirTreeCtrl.h"
#include "PC_Browser.h"
#include "PC_BrowserDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPC_BrowserDlg dialog
CPC_BrowserDlg::CPC_BrowserDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPC_BrowserDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPC_BrowserDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CPC_BrowserDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPC_BrowserDlg)
DDX_Control(pDX, ID_BROWSETREE, m_dir);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPC_BrowserDlg, CDialog)
//{{AFX_MSG_MAP(CPC_BrowserDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(ID_SHOWPATH, OnShowpath)
ON_BN_CLICKED(ID_SETPATH, OnSetpath)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPC_BrowserDlg message handlers
BOOL CPC_BrowserDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_dir.Initialize();
return TRUE; // return TRUE unless you set the focus to a control
}
void CPC_BrowserDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
CDialog::OnSysCommand(nID, lParam);
}
void CPC_BrowserDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
HCURSOR CPC_BrowserDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CPC_BrowserDlg::OnShowpath()
{
HTREEITEM hItem=m_dir.GetSelectedItem();
if (hItem)
MessageBox (m_dir.GetFullPath(hItem));
else
MessageBox ("没有选择条目...");
}
void CPC_BrowserDlg::OnSetpath()
{
if (!m_dir.SetPath("C:\\\\winnt\\system32"))
MessageBox ("c:\\\\Winnt\\system32 Not Found");
MessageBox ("请按OK按钮继续");
if (!m_dir.SetPath("C:\\\\windows\\system"))
MessageBox ("c:\\\\Windows\\System Not Found");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -