【VC开源代码栏目提醒】:网学会员--在 VC开源代码编辑为广大网友搜集整理了:CText_1View.cpp绩等信息,祝愿广大网友取得需要的信息,参考学习。
// CText_1View.cpp : implementation of the CCText_1View class
//
#include "stdafx.h"
#include "CText_1.h"
#include "CText_1Doc.h"
#include "CText_1View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCText_1View
IMPLEMENT_DYNCREATE(CCText_1View, CView)
BEGIN_MESSAGE_MAP(CCText_1View, CView)
//{{AFX_MSG_MAP(CCText_1View)
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_1View construction/destruction
CCText_1View::CCText_1View()
{
// TODO: add construction code here
}
CCText_1View::~CCText_1View()
{
}
BOOL CCText_1View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCText_1View drawing
void CCText_1View::OnDraw(CDC* pDC)
{
CCText_1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CCText_1View printing
BOOL CCText_1View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CCText_1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CCText_1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CCText_1View diagnostics
#ifdef _DEBUG
void CCText_1View::AssertValid() const
{
CView::AssertValid();
}
void CCText_1View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCText_1Doc* CCText_1View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCText_1Doc)));
return (CCText_1Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCText_1View message handlers
int CCText_1View::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
CClientDC dc(this);
TEXTMETRIC tm;
dc.GetTextMetrics(&tm); //获得字符的信息
CreateSolidCaret(tm.tmAveCharWidth/8,tm.tmHeight); //创建插入符
ShowCaret(); //显示插入符
return 0;
}
void CCText_1View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
SetCaretPos(point); //改变插入符的位置
CView::OnLButtonDown(nFlags, point);
}
上一篇:
CText_1Doc.cpp
下一篇:
陕西师范大学远程教育学院毕业论文