⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trydecrypt006view.cpp

📁 windows写字板的源代码
💻 CPP
字号:
// TryDecrypt006View.cpp : implementation of the CTry006View class
//

#include "stdafx.h"
#include "TryDecrypt006.h"

#include "TryDecrypt006Doc.h"
#include "TryDecrypt006View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CEdit* PMyEdit;
//extern CTry006View* (class CTry006View*)PTry006View;
extern PMainFrame;
extern CTry006View* PTry006View;
extern CTryDecrypt006Doc* PTryDecrypt006Doc;
CTry006View* PTry006View;

/////////////////////////////////////////////////////////////////////////////
// CTry006View

IMPLEMENT_DYNCREATE(CTry006View, CView)

BEGIN_MESSAGE_MAP(CTry006View, CView)
	//{{AFX_MSG_MAP(CTry006View)
	ON_WM_CREATE()
	ON_WM_SIZE()
	ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
	ON_COMMAND(ID_EDIT_CUT, OnEditCut)
	ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
	ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
	//ON_BN_CLICKED(IDC_BUTTON1, CTry006View::OnButton1)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTry006View construction/destruction

CTry006View::CTry006View()
{
	// TODO: add construction code here
	PTry006View=this;
}

CTry006View::~CTry006View()
{
}

BOOL CTry006View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CTry006View drawing

void CTry006View::OnDraw(CDC* pDC)
{
	CTryDecrypt006Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CTry006View printing

BOOL CTry006View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CTry006View::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	// TODO: add extra initialization before printing
	//PrintClient( pDC, PRF_CLIENT );
	/*
	CEdit::OnPrint(pDC, pInfo);
	if (pInfo != NULL && pInfo->m_bPreview)
		DrawMargins(pDC);
	CDC printDC;
	extern CTryDecrypt006App theApp;
	theApp.CreatePrinterDC(printDC);
	CString strToPrint;
	m_edit.GetWindowText(strToPrint);
	printDC.TextOut(10,10,strToPrint);
	Print(&printDC,PRF_CHECKVISIBLE);
	pInfo->m_bDocObject=TRUE;*/
}

void CTry006View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CTry006View diagnostics

#ifdef _DEBUG
void CTry006View::AssertValid() const
{
	CView::AssertValid();
}

void CTry006View::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CTryDecrypt006Doc* CTry006View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTryDecrypt006Doc)));
	return (CTryDecrypt006Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTry006View message handlers

BOOL CTry006View::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
{
	// TODO: Add your specialized code here and/or call the base class
	return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}

int CTry006View::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	/*
	m_progressBar.Create(WS_CHILD|WS_VISIBLE|WS_BORDER,CRect(20,40,250,80),
		this,IDC_PROGRESSBAR);
	m_TryButton.Create(_T("button test"),WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
		CRect(400,400,470,430),this,IDC_BUTTON1);
	*/
	m_edit.Create(ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_MULTILINE|ES_WANTRETURN|
		WS_EX_STATICEDGE|WS_VISIBLE|WS_CHILD|WS_VSCROLL|WS_HSCROLL//|WS_BORDER
		,CRect(10,10,300,300),this,IDC_EDIT);
	m_edit.LimitText();
	static CFont myEditFont;
	LOGFONT myEditFontLog={0};
	myEditFontLog.lfHeight=16;
	myEditFontLog.lfWidth=8;
	strcpy(myEditFontLog.lfFaceName,"宋体");

	myEditFont.CreateFontIndirect(&myEditFontLog);
	//(16,8,0,0,2,0,0,0,DEFAULT_CHARSET,1,2,1,1,"宋体");
	m_edit.SetFont(&myEditFont);
	extern CEdit* PMyEdit;
	PMyEdit=&m_edit;
	return 0;
}

/*
void CTry006View::OnButton1(void) 
{
	MessageBeep(MB_OK);
	CDC* pDC=GetDC();
	pDC->TextOut(10,15,_T("Button test pushed."));
	ReleaseDC(pDC);
}
*/

void CTry006View::OnSize(UINT nType, int cx, int cy) 
{
	CView::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	CRect tempRect;
	tempRect.left=0;
	tempRect.top=0;
	tempRect.right=cx;
	tempRect.bottom=cy;
	m_edit.MoveWindow(tempRect,TRUE);
}


void CTry006View::OnEditCopy() 
{
	// TODO: Add your command handler code here
	extern CEdit* PMyEdit;
	PMyEdit->Copy();
}


void CTry006View::OnEditCut() 
{
	// TODO: Add your command handler code here
	extern CEdit* PMyEdit;
	PMyEdit->Cut();
	
}

void CTry006View::OnEditPaste() 
{
	// TODO: Add your command handler code here
	extern CEdit* PMyEdit;
	PMyEdit->Paste();
}


void CTry006View::OnEditUndo() 
{
	// TODO: Add your command handler code here
	extern CEdit* PMyEdit;
	PMyEdit->Undo();
}

void CTry006View::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
{
	// TODO: Add your specialized code here and/or call the base class
	CString strToPrint;
	m_edit.GetWindowText(strToPrint);
	pDC->ExtTextOut(10,10,ETO_CLIPPED,CRect(0,0,640,100),strToPrint,NULL);
	//Print only the first line of the file.
	//pInfo->m_bDocObject=TRUE;
	CView::OnPrint(pDC, pInfo);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -