⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drawimagedemoview.cpp

📁 VC.net 的一些有用的技巧
💻 CPP
字号:
// DrawImageDemoView.cpp : CDrawImageDemoView 类的实现
//

#include "stdafx.h"
#include "DrawImageDemo.h"

#include "DrawImageDemoDoc.h"
#include "DrawImageDemoView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CDrawImageDemoView

IMPLEMENT_DYNCREATE(CDrawImageDemoView, CView)

BEGIN_MESSAGE_MAP(CDrawImageDemoView, CView)
END_MESSAGE_MAP()

// CDrawImageDemoView 构造/销毁

CDrawImageDemoView::CDrawImageDemoView()
{
	// TODO: 在此处添加构造代码

}

CDrawImageDemoView::~CDrawImageDemoView()
{
}

BOOL CDrawImageDemoView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或
	// 样式

	return CView::PreCreateWindow(cs);
}

// CDrawImageDemoView 绘制

void CDrawImageDemoView::OnDraw(CDC* pDC)
{
	CDrawImageDemoDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// TODO: 在此处为本机数据添加绘制代码
	using namespace Gdiplus;

	//
	Graphics myGraphics(pDC->m_hDC);
	Image image(L"Pic.jpg");
	Image* pThumbnail = image.GetThumbnailImage(100, 100, NULL, NULL);
	myGraphics.DrawImage(
		pThumbnail,
		10,
		10,
		pThumbnail->GetWidth(),
		pThumbnail->GetHeight());

	

	/*Image myImage(L"cvn.jpg");
	Rect expansionRect(250,10,myImage.GetWidth()*2,myImage.GetHeight()*2);
	Rect compressionRect(10,170,myImage.GetWidth()/2,myImage.GetHeight()/2);
	myGraphics.DrawImage(&myImage, 10, 10);
	myGraphics.DrawImage(&myImage, expansionRect);
	myGraphics.DrawImage(&myImage, compressionRect);*/

	/*Image myImage1(L"a.bmp");
		
	myGraphics.DrawImage(&myImage1,10,10);

	myGraphics.SetInterpolationMode(InterpolationModeNearestNeighbor);
	myGraphics.DrawImage(&myImage1,Rect(210,10,myImage1.GetWidth()/2,myImage1.GetHeight()/2));
	
	myGraphics.SetInterpolationMode(InterpolationModeHighQualityBilinear);
	myGraphics.DrawImage(&myImage1,Rect(310,10,myImage1.GetWidth()/2,myImage1.GetHeight()/2));

	myGraphics.SetInterpolationMode(InterpolationModeHighQualityBicubic);
	myGraphics.DrawImage(&myImage1,Rect(410,10,myImage1.GetWidth()/2,myImage1.GetHeight()/2));*/

	/*Point destinationPoints[] = {
	Point(500, 20),   // destination for upper-left point of original
	Point(340, 100),  // destination for upper-right point of original
	Point(400, 40)};  // destination for lower-left point of original

	Image myImage(L"cvn.jpg");

	// Draw the image unaltered with its upper-left corner at (20,20).
	myGraphics.DrawImage(&myImage,20, 20);

	// Draw the image mapped to the parallelogram.
	myGraphics.DrawImage(&myImage,destinationPoints,3);*/
	}


// CDrawImageDemoView 诊断

#ifdef _DEBUG
void CDrawImageDemoView::AssertValid() const
{
	CView::AssertValid();
}

void CDrawImageDemoView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CDrawImageDemoDoc* CDrawImageDemoView::GetDocument() const // 非调试版本是内联的
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDrawImageDemoDoc)));
	return (CDrawImageDemoDoc*)m_pDocument;
}
#endif //_DEBUG


// CDrawImageDemoView 消息处理程序

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -