📄 mygraphview.cpp
字号:
// MyGraphView.cpp : implementation of the CMyGraphView class
//
#include "stdafx.h"
#include "MyGraph.h"
#include "MyGraphDoc.h"
#include "MyGraphView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyGraphView
IMPLEMENT_DYNCREATE(CMyGraphView, CView)
BEGIN_MESSAGE_MAP(CMyGraphView, CView)
//{{AFX_MSG_MAP(CMyGraphView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyGraphView construction/destruction
CMyGraphView::CMyGraphView()
{
// TODO: add construction code here
}
CMyGraphView::~CMyGraphView()
{
}
BOOL CMyGraphView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMyGraphView drawing
void CMyGraphView::OnDraw(CDC* pDC)
{
CMyGraphDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CRect rectClient;
GetClientRect(rectClient); // 得到用户区窗口
pDC->SetMapMode(MM_ANISOTROPIC); // 映射模式设置为MM_ANISOTROPIC
pDC->SetWindowExt(800, 800); // 定义逻辑窗口
pDC->SetViewportExt(rectClient.right, -rectClient.bottom); // 定义输出视口
pDC->SetViewportOrg(rectClient.right/2, rectClient. bottom/2); // 设置视口原点
pDC->Ellipse(CRect(-200, -200, 200, 200)); // 在逻辑窗口绘圆
pDC->SetMapMode(MM_ISOTROPIC); // 映射模式设置为MM_ISOTROPIC
pDC->SetWindowExt(800, 800);
pDC->SetViewportExt(rectClient.right, -rectClient.bottom);
pDC->SetViewportOrg(rectClient.right/2, rectClient. bottom/2);
pDC->Ellipse(CRect(-200, -200, 200, 200)); // 在逻辑窗口绘圆
}
/////////////////////////////////////////////////////////////////////////////
// CMyGraphView diagnostics
#ifdef _DEBUG
void CMyGraphView::AssertValid() const
{
CView::AssertValid();
}
void CMyGraphView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMyGraphDoc* CMyGraphView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyGraphDoc)));
return (CMyGraphDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMyGraphView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -