📄 exampl~3.cpp
字号:
// Example010View.cpp : CExample010View 类的实现
//
#include "stdafx.h"
#include "Example010.h"
#include "Example010Doc.h"
#include "Example010View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CExample010View
IMPLEMENT_DYNCREATE(CExample010View, CView)
BEGIN_MESSAGE_MAP(CExample010View, CView)
END_MESSAGE_MAP()
// CExample010View 构造/销毁
CExample010View::CExample010View()
{
// TODO: 在此处添加构造代码
}
CExample010View::~CExample010View()
{
}
BOOL CExample010View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或
// 样式
return CView::PreCreateWindow(cs);
}
// CExample010View 绘制
void CExample010View::OnDraw(CDC* pDC)
{
CExample010Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: 在此处为本机数据添加绘制代码
using namespace Gdiplus;
Graphics graphics(pDC->m_hDC);
Image image(L"Test.bmp");
graphics.DrawImage(&image, 10, 15, image.GetWidth(), image.GetHeight());
Pen opaquePen(Color(255, 0, 0, 255), 55);
graphics.DrawLine(&opaquePen, 0, 50, 260, 50);
Pen semiTransPen(Color(128, 0, 0, 255), 55);
graphics.DrawLine(&semiTransPen, 0, 120, 260, 120);
graphics.SetCompositingQuality(CompositingQualityGammaCorrected);
graphics.DrawLine(&semiTransPen, 0, 190, 260, 190);
}
// CExample010View 诊断
#ifdef _DEBUG
CExample010Doc* CExample010View::GetDocument() const // 非调试版本是内联的
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CExample010Doc)));
return (CExample010Doc*)m_pDocument;
}
#endif //_DEBUG
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -