?? exampleview.cpp
字號:
// ExampleView.cpp : implementation of the CExampleView class
//
#include "stdafx.h"
#include "Example.h"
#include "ExampleDoc.h"
#include "ExampleView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExampleView
IMPLEMENT_DYNCREATE(CExampleView, CView)
BEGIN_MESSAGE_MAP(CExampleView, CView)
//{{AFX_MSG_MAP(CExampleView)
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()
/////////////////////////////////////////////////////////////////////////////
// CExampleView construction/destruction
CExampleView::CExampleView()
{
// TODO: add construction code here
m_tracker.m_rect.SetRect(0, 0, 30, 30);
m_tracker.m_nStyle=CRectTracker::resizeInside | CRectTracker::dottedLine;
}
CExampleView::~CExampleView()
{
}
BOOL CExampleView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CExampleView drawing
void CExampleView::OnDraw(CDC* pDC)
{
CExampleDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CBrush brush (RGB (0, 0, 255));
CBrush* pOldBrush=pDC->SelectObject(&brush);
CRect rcEllipse;
m_tracker.GetTrueRect(rcEllipse);
pDC->Ellipse(rcEllipse);
m_tracker.Draw(pDC);
pDC->SelectObject(pOldBrush);
}
/////////////////////////////////////////////////////////////////////////////
// CExampleView diagnostics
#ifdef _DEBUG
void CExampleView::AssertValid() const
{
CView::AssertValid();
}
void CExampleView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CExampleDoc* CExampleView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CExampleDoc)));
return (CExampleDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CExampleView message handlers
void CExampleView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CExampleDoc* pDoc=GetDocument();
ASSERT_VALID(pDoc);
BOOL bResult=m_tracker.HitTest(point)!= CRectTracker::hitNothing;
if (bResult)
{
m_tracker.Track (this,point,true);
pDoc->SetModifiedFlag();
pDoc->UpdateAllViews(NULL);
}
else
m_tracker.TrackRubberBand(this,point,true);
CView::OnLButtonDown(nFlags, point);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -