📄 intelligentftpdlg.cpp
字号:
// IntelligentFtpDlg.cpp : implementation file
//
#include "stdafx.h"
#include "IntelligentFtp.h"
#include "IntelligentFtpDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CIntelligentFtpDlg dialog
CIntelligentFtpDlg::CIntelligentFtpDlg(CWnd* pParent /*=NULL*/)
: CDialog(CIntelligentFtpDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CIntelligentFtpDlg)
// 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 CIntelligentFtpDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CIntelligentFtpDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CIntelligentFtpDlg, CDialog)
//{{AFX_MSG_MAP(CIntelligentFtpDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CIntelligentFtpDlg message handlers
BOOL CIntelligentFtpDlg::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
CRect rect(0,0,800,600); //调整主窗口大小
MoveWindow(&rect,TRUE );
rect.CopyRect(new CRect(30,20,800-30,600-50));
m_PropertySheet.m_Rect = rect;
m_PropertySheet.m_nPages = -1; // init this membervariable
m_PropertySheet.m_nActPage = 0; // init this membervariable
//创建属性页
m_PropertySheet.Create (WS_VISIBLE | WS_CHILD | WS_TABSTOP,
m_PropertySheet.m_Rect, this, m_PropertySheet.m_nCtrlID);
//添加属性页
CPropertyPages * pPropPage = NULL;
TC_ITEM Item;
Item.mask = TCIF_TEXT;
int nN;
int nPages = 3; // in my example I have two pages
for (nN = 0; nN < nPages; nN++) {
pPropPage = new (CPropertyPages); // new it
// Create the tab and the dialog
switch (nN)
{
case 0:
Item.pszText = "站点";
pPropPage->m_pDialogPage = (CDialog*)&m_SearchSite;
pPropPage->m_pDialogPage->Create(IDD_SEARCHSITE, &m_PropertySheet);
break;
case 1:
Item.pszText = "列表";
pPropPage->m_pDialogPage = (CDialog*)&m_ListContent;
pPropPage->m_pDialogPage->Create(IDD_LISTCONTENT, &m_PropertySheet);
break;
case 2:
Item.pszText = "查询";
pPropPage->m_pDialogPage = (CDialog*)&m_QueryItems;
pPropPage->m_pDialogPage->Create(IDD_QUERYITEMS, &m_PropertySheet);
break;
}
m_PropertySheet.InsertItem (nN,&Item);
// pPropPage->m_hLocal = NULL;
m_PropertySheet.m_Dialogs.Add(pPropPage);
m_PropertySheet.m_nPages++;
pPropPage->m_Rect.top = m_PropertySheet.m_Rect.top + 15;
pPropPage->m_Rect.left = m_PropertySheet.m_Rect.left + 10;
pPropPage->m_Rect.bottom = m_PropertySheet.m_Rect.bottom - m_PropertySheet.m_Rect.top - 10;
pPropPage->m_Rect.right = m_PropertySheet.m_Rect.right - m_PropertySheet.m_Rect.left - 10;
pPropPage->m_pDialogPage->SetWindowPos(NULL, pPropPage->m_Rect.left,
pPropPage->m_Rect.top, 0, 0,
SWP_HIDEWINDOW | SWP_NOSIZE);
}
m_SearchSite.SetWindowPos(NULL, pPropPage->m_Rect.left,
pPropPage->m_Rect.top, 0, 0,
SWP_SHOWWINDOW | SWP_NOSIZE);
return TRUE;
}
void CIntelligentFtpDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CIntelligentFtpDlg::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();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CIntelligentFtpDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CIntelligentFtpDlg::OnOK()
{
// TODO: Add extra validation here
// CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -