📄 exampl~3.cpp
字号:
// Example006View.cpp : CExample006View 类的实现
//
#include "stdafx.h"
#include "Example006.h"
#include "Example006Doc.h"
#include "Example006View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CExample006View
IMPLEMENT_DYNCREATE(CExample006View, CView)
BEGIN_MESSAGE_MAP(CExample006View, CView)
END_MESSAGE_MAP()
// CExample006View 构造/销毁
CExample006View::CExample006View()
{
// TODO: 在此处添加构造代码
}
CExample006View::~CExample006View()
{
}
BOOL CExample006View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或
// 样式
return CView::PreCreateWindow(cs);
}
// CExample006View 绘制
void CExample006View::OnDraw(CDC* pDC)
{
CExample006Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: 在此处为本机数据添加绘制代码
using namespace Gdiplus;
Graphics graphics(pDC->m_hDC);
Pen pen(Color(255, 0, 0, 255), 8);
pen.SetStartCap(LineCapArrowAnchor);
pen.SetEndCap(LineCapRoundAnchor);
graphics.DrawLine(&pen, 20, 20, 300, 20);
pen.SetStartCap(LineCapRoundAnchor);
pen.SetEndCap(LineCapDiamondAnchor);
graphics.DrawLine(&pen, 20, 60, 300, 60);
pen.SetStartCap(LineCapFlat);
pen.SetEndCap(LineCapTriangle);
graphics.DrawLine(&pen, 20, 100, 300, 100);
}
// CExample006View 诊断
#ifdef _DEBUG
CExample006Doc* CExample006View::GetDocument() const // 非调试版本是内联的
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CExample006Doc)));
return (CExample006Doc*)m_pDocument;
}
#endif //_DEBUG
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -