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

📄 bitmap.h

📁 一个MFC实例
💻 H
字号:
//-----------------------------------------------------------------
// 来源于游戏编程入门
// 主要是创建和绘制位图
//-----------------------------------------------------------------

#pragma once

//-----------------------------------------------------------------
// Include Files
//-----------------------------------------------------------------
#include <windows.h>

//-----------------------------------------------------------------
// Bitmap Class
//-----------------------------------------------------------------
class Bitmap
{
protected:
  // Member Variables
  HBITMAP m_hBitmap;
  int     m_iWidth, m_iHeight;

  // Helper Methods
  void Free();

public:
  // Constructor(s)/Destructor
  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();

  // General Methods
  BOOL Create(HDC hDC, LPTSTR szFileName);
  BOOL Create(HDC hDC, UINT uiResID, HINSTANCE hInstance);
  BOOL Create(HDC hDC, int iWidth, int iHeight, COLORREF crColor);
  void Draw(HDC hDC, int x, int y);
  int  GetWidth() { return m_iWidth; };
  int  GetHeight() { return m_iHeight; };
};

⌨️ 快捷键说明

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