📄 bitmap.cpp
字号:
// Bitmap.cpp: implementation of the CMyBitmap class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Bitmap.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMyBitmap::CMyBitmap()
{
}
bool CMyBitmap::Init(HINSTANCE hInstance, HDC hDc, WORD wBmpID)
{
BITMAP bm;
hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(wBmpID));
if( !hDc || !hBitmap)
return 0;
hMemDc = CreateCompatibleDC(hDc);
SelectObject(hMemDc, hBitmap);
SetMapMode(hMemDc, GetMapMode(hDc));
GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
pt.x = bm.bmWidth;
pt.y = bm.bmHeight;
return 1;
}
bool CMyBitmap::Show(HDC hDc, int x, int y)
{
int iResult;
iResult = BitBlt(hDc, x, y, pt.x, pt.y, hMemDc, 0, 0, SRCCOPY);
if (iResult == 0)
return 0;
else return 1;
}
CMyBitmap::~CMyBitmap()
{
DeleteDC(hMemDc);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -