?? encodeview.cpp
字號:
// EncodeView.cpp : implementation of the CEncodeView class
//
#include "stdafx.h"
#include "Encode.h"
#include "EncodeDoc.h"
#include "EncodeView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEncodeView
IMPLEMENT_DYNCREATE(CEncodeView, CEditView)
BEGIN_MESSAGE_MAP(CEncodeView, CEditView)
//{{AFX_MSG_MAP(CEncodeView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEncodeView construction/destruction
CEncodeView::CEncodeView()
{
// TODO: add construction code here
}
CEncodeView::~CEncodeView()
{
}
BOOL CEncodeView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
BOOL bPreCreated = CEditView::PreCreateWindow(cs);
cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL); // Enable word-wrapping
return bPreCreated;
}
/////////////////////////////////////////////////////////////////////////////
// CEncodeView drawing
void CEncodeView::OnDraw(CDC* pDC)
{
CEncodeDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CEncodeView printing
BOOL CEncodeView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default CEditView preparation
return CEditView::OnPreparePrinting(pInfo);
}
void CEncodeView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// Default CEditView begin printing.
CEditView::OnBeginPrinting(pDC, pInfo);
}
void CEncodeView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// Default CEditView end printing
CEditView::OnEndPrinting(pDC, pInfo);
}
/////////////////////////////////////////////////////////////////////////////
// CEncodeView diagnostics
#ifdef _DEBUG
void CEncodeView::AssertValid() const
{
CEditView::AssertValid();
}
void CEncodeView::Dump(CDumpContext& dc) const
{
CEditView::Dump(dc);
}
CEncodeDoc* CEncodeView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEncodeDoc)));
return (CEncodeDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEncodeView message handlers
void CEncodeView::SerializeRaw(CArchive &ar)
{
CEdit& theEdit = GetEditCtrl(); //取得編輯控件
CString tempStr;
LPTSTR p;
if(ar.IsStoring ())
{
int length=theEdit.GetWindowTextLength (); //得到編輯控件中文本長度
p=tempStr.GetBuffer(length);
theEdit.GetWindowText (p,length+1); //得到編輯控件中文本
int i=0;
while(p[i]) //用0x80作為密匙加密
{
p[i]^=0x80;
i++;
}
tempStr.ReleaseBuffer ();
ar<<tempStr; //寫文件
}
else
{
ar>>tempStr; //讀文件
p=tempStr.GetBuffer(tempStr.GetLength());
int i=0;
while(p[i]) //用0x80作為密匙解密
{
p[i]^=0x80;
i++;
}
tempStr.ReleaseBuffer ();
theEdit.SetWindowText (tempStr);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -