|
#include "stdafx.h"
#include "CGdiPlusBitmapTest.h"
#include "ChildView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
CChildView::CChildView()
{
}
CChildView::~CChildView()
{
}
BEGIN_MESSAGE_MAP(CChildView, CWnd)
ON_WM_PAINT()
ON_COMMAND(ID_LOADJPG, OnLoadJpg)
ON_COMMAND(ID_LOADPNG, OnLoadPng)
END_MESSAGE_MAP()
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CWnd::PreCreateWindow(cs))
return FALSE;
cs.dwExStyle |= WS_EX_CLIENTEDGE;
cs.style &= ~WS_BORDER;
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
::LoadCursor(NULL, IDC_ARROW), reinterpret_cast<HBRUSH>(COLOR_WINDOW+1), NULL);
return TRUE;
}
void CChildView::OnPaint()
{
CPaintDC dc(this);
Gdiplus::Graphics graphics(dc);
graphics.DrawImage(m_bitmap, 0, 0);
}
void CChildView::OnLoadJpg()
{
m_bitmap.Load(IDB_SUNSET);
Invalidate();
}
void CChildView::OnLoadPng()
{
CGdiPlusBitmapResource* m_pBitmap = new CGdiPlusBitmapResource;
m_pBitmap->Load(_T("IDB_BAY"), _T("PNG"));
CClientDC dc(this);
Gdiplus::Graphics graphics(dc);
graphics.DrawImage(*m_pBitmap, 0, 0);
delete m_pBitmap;
// m_bitmap.Load(_T("IDB_BAY"), _T("PNG"));
// Invalidate();
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Joe is one of those software engineers with a film degree. His first paid programming job (you think film is a good way to make a living?) was writing games for Apple II's using 6502 assembly. He soon moved to 80x86 assembly, C, C++ (for a long time), C# and then back to C++ with occasional dabbling in C#, Python and other vile languages.
He first wrote software for Windows 3.0 in 1990. Save for some work in Linux, DOS and a mercifully brief foray into OS/2, he has concentrated on designing and writing software for all versions and types of Windows except RT.