📄 bitmap.h
字号:
//-----------------------------------------------------------------
// Bitmap Object
// C++ Header - Bitmap.h
//-----------------------------------------------------------------
#pragma once
//-----------------------------------------------------------------
// Include Files
//-----------------------------------------------------------------
#include <windows.h>
//-----------------------------------------------------------------
//Bitmap类
//-----------------------------------------------------------------
class Bitmap
{
protected:
//成员变量
HBITMAP m_hBitmap; //每一个位图对象都必须记录其句柄,因为Windows GDI需要位图句柄来绘制位图
int m_iWidth, m_iHeight;
//帮助器方法
void Free(); //是在Bitmap类中使用的一个帮助器方法,用来释放与位图有关的内存
public:
//构造函数/析构函数
Bitmap();
Bitmap(HDC hDC, LPTSTR szFileName);
Bitmap(HDC hDC, UINT uiResID, HINSTANCE hInstance);
Bitmap(HDC hDC, int iWidth, int iHeight, COLORREF crColor = RGB(0, 0, 0));
virtual ~Bitmap();
//常规方法
BOOL Create(HDC hDC, LPTSTR szFileName);
BOOL Create(HDC hDC, UINT uiResID, HINSTANCE hInstance);
BOOL Create(HDC hDC, int iWidth, int iHeight, COLORREF crColor);
virtual void Draw(HDC hDC, int x, int y, BOOL bTrans = FALSE, //提供了一种将位图绘制到设备环境上的方法
COLORREF crTransColor = RGB(255, 0, 255));
void DrawPart(HDC hDC, int x, int y, int xPart, int yPart,
int wPart, int hPart, BOOL bTrans = FALSE,
COLORREF crTransColor = RGB(255, 0, 255));
int GetWidth() { return m_iWidth; };
int GetHeight() { return m_iHeight; };
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -