【VC开源代码栏目提醒】:网学会员在VC开源代码频道为大家收集整理了CText_2View.cpp提供大家参考,希望对大家有所帮助!
// CText_2View.cpp : implementation of the CCText_2View class
//
#include "stdafx.h"
#include "CText_2.h"
#include "CText_2Doc.h"
#include "CText_2View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCText_2View
IMPLEMENT_DYNCREATE(CCText_2View, CView)
BEGIN_MESSAGE_MAP(CCText_2View, CView)
//{{AFX_MSG_MAP(CCText_2View)
ON_WM_CREATE()
ON_WM_LBUTTONDOWN()
//}}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)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCText_2View construction/destruction
CCText_2View::CCText_2View()
{
// TODO: add construction code here
}
CCText_2View::~CCText_2View()
{
}
BOOL CCText_2View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCText_2View drawing
void CCText_2View::OnDraw(CDC* pDC)
{
CCText_2Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CCText_2View printing
BOOL CCText_2View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CCText_2View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CCText_2View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CCText_2View diagnostics
#ifdef _DEBUG
void CCText_2View::AssertValid() const
{
CView::AssertValid();
}
void CCText_2View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCText_2Doc* CCText_2View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCText_2Doc)));
return (CCText_2Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCText_2View message handlers
int CCText_2View::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
static CBitmap bitmap; //与资源相关的对象,在对象析构时会发生销毁
bitmap.LoadBitmap(IDB_BITMAP1); //将变量与资源关联
CreateCaret(&bitmap);//创建图形化插入符
ShowCaret();
return 0;
}
void CCText_2View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
SetCaretPos(point);
CView::OnLButtonDown(nFlags, point);
}
上一篇:
CText_2Doc.cpp
下一篇:
历史研究组织机构