?? base64projdlg.cpp
字號:
// Base64ProjDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Base64Proj.h"
#include "Base64ProjDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBase64ProjDlg dialog
CBase64ProjDlg::CBase64ProjDlg(CWnd* pParent /*=NULL*/)
: CDialog(CBase64ProjDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CBase64ProjDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CBase64ProjDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBase64ProjDlg)
DDX_Control(pDX, IDC_TAB_INFO, m_TabCtrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBase64ProjDlg, CDialog)
//{{AFX_MSG_MAP(CBase64ProjDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_INFO, OnSelchangeTabInfo)
ON_BN_CLICKED(IDC_RADIO_ENCODE, OnRadioEncode)
ON_BN_CLICKED(IDC_RADIO_DECODE, OnRadioDecode)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBase64ProjDlg message handlers
BOOL CBase64ProjDlg::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
((CButton*)GetDlgItem(IDC_RADIO_ENCODE))->SetCheck(1);
m_TabCtrl.InsertItem(0, " 字符串加密(解密) ");
m_TabCtrl.InsertItem(1, " 文件加密(解密) ");
m_TabCtrl.InsertItem(2, " 關于 ");
m_Base64StringDlg.Create(IDD_DIALOG_STRING, GetDlgItem(IDC_TAB_INFO));
m_Base64FileDlg.Create (IDD_DIALOG_FILE, GetDlgItem(IDC_TAB_INFO));
m_AboutDlg.Create (IDD_ABOUTBOX, GetDlgItem(IDC_TAB_INFO));
RECT rcTabCtrl;
m_TabCtrl.GetClientRect(&rcTabCtrl);
rcTabCtrl.top += 25;
rcTabCtrl.left += 5;
rcTabCtrl.bottom -= 10;
rcTabCtrl.right -= 10;
m_Base64StringDlg.MoveWindow(&rcTabCtrl);
m_Base64FileDlg.MoveWindow (&rcTabCtrl);
m_AboutDlg.MoveWindow (&rcTabCtrl);
m_Base64StringDlg.ShowWindow(SW_SHOW);
m_TabCtrl.SetCurSel(0);
return TRUE; // return TRUE unless you set the focus to a control
}
// 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 CBase64ProjDlg::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 CBase64ProjDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CBase64ProjDlg::OnSelchangeTabInfo(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int nIndex = m_TabCtrl.GetCurSel();
switch(nIndex)
{
case 0:
m_Base64StringDlg.ShowWindow(SW_SHOW);
m_Base64FileDlg.ShowWindow (SW_HIDE);
m_AboutDlg.ShowWindow (SW_HIDE);
break;
case 1:
m_Base64StringDlg.ShowWindow(SW_HIDE);
m_Base64FileDlg.ShowWindow (SW_SHOW);
m_AboutDlg.ShowWindow (SW_HIDE);
break;
case 2:
m_Base64StringDlg.ShowWindow(SW_HIDE);
m_Base64FileDlg.ShowWindow (SW_HIDE);
m_AboutDlg.ShowWindow (SW_SHOW);
break;
break;
}
*pResult = 0;
}
void CBase64ProjDlg::OnRadioEncode()
{
m_bIsEncode = true;
}
void CBase64ProjDlg::OnRadioDecode()
{
m_bIsEncode = false;
}
bool CBase64ProjDlg::IsEncode()
{
return m_bIsEncode;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -