📄 smallcad203view.cpp
字号:
// SmallCAD203View.cpp : implementation of the CSmallCAD203View class
//
#include "stdafx.h"
#include "SmallCAD203.h"
#include "SmallCAD203Doc.h"
#include "SmallCAD203View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSmallCAD203View
IMPLEMENT_DYNCREATE(CSmallCAD203View, CView)
BEGIN_MESSAGE_MAP(CSmallCAD203View, CView)
//{{AFX_MSG_MAP(CSmallCAD203View)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
ON_COMMAND(ID_CLEAR, OnClear)
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CSmallCAD203View construction/destruction
CSmallCAD203View::CSmallCAD203View()
{
// TODO: add construction code here
}
CSmallCAD203View::~CSmallCAD203View()
{
}
BOOL CSmallCAD203View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CSmallCAD203View drawing
void CSmallCAD203View::OnDraw(CDC* pDC)
{
CSmallCAD203Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
//CSmallCAD203Doc *pDoc=GetDoCument();
ASSERT_VALID(pDoc);
CGraph* p=pDoc->my_list.GetHead();
//for(int i=0;i<pDoc->GetGraphNumber();i++)
// pDoc->GetGraph(i)->Draw(pDC);
while(p)
{p->Draw(pDC);
p=p->next;
}
}
/////////////////////////////////////////////////////////////////////////////
// CSmallCAD203View printing
BOOL CSmallCAD203View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CSmallCAD203View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CSmallCAD203View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CSmallCAD203View diagnostics
#ifdef _DEBUG
void CSmallCAD203View::AssertValid() const
{
CView::AssertValid();
}
void CSmallCAD203View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CSmallCAD203Doc* CSmallCAD203View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSmallCAD203Doc)));
return (CSmallCAD203Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSmallCAD203View message handlers
void CSmallCAD203View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(GetDocument()->GetCurrentFunction()!=NULL)
GetDocument()->GetCurrentFunction()->OnLButtonDown(nFlags,point);
CView::OnLButtonDown(nFlags, point);
}
void CSmallCAD203View::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(GetDocument()->GetCurrentFunction()!=NULL)
GetDocument()->GetCurrentFunction()->OnLButtonUp(nFlags,point);
CView::OnLButtonUp(nFlags, point);
}
void CSmallCAD203View::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CStatusBar *pStatus=(CStatusBar *)AfxGetApp()->m_pMainWnd->GetDescendantWindow(ID_VIEW_STATUS_BAR);
if(pStatus)
{
char tbuf[20];
sprintf(tbuf,"坐标(%d,%d)",point.x,point.y);
pStatus->SetPaneText(1,tbuf);
}
if(GetDocument()->GetCurrentFunction()!=NULL)
GetDocument()->GetCurrentFunction()->OnMouseMove(nFlags,point);
CView::OnMouseMove(nFlags, point);
}
void CSmallCAD203View::OnClear()
{
// TODO: Add your command handler code here
CSmallCAD203Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->my_list.DeleteGraph();
Invalidate();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -