📄 graphics.h
字号:
#pragma once
#include <windows.h>
class CFont;
class CGraphics
{
public:
CGraphics(HWND hWnd);
CGraphics(HDC hParentDc, int w, int h);
~CGraphics(void);
void BeginPaint();
void EndPaint();
const RECT* GetPaintRect();
void SetOrigin(int x, int y);
void DrawRoundRect(const RECT* pRect, int nEllipseWidth, int nEllipseHeight);
void DrawText(const RECT* pRect, char* pText, int nFormat);
void SetColor(int rgb);
void SetBgColor(int rgb);
void SetFont(CFont* pFont);
void Copy(const RECT* pDestRect, CGraphics* pSrc, int x, int y);
void DrawRect(const RECT* pRect);
void DrawLine(int x1, int y1, int x2, int y2);
private:
HWND m_hWnd;
HDC m_hDc;
PAINTSTRUCT m_ps;
HBITMAP m_hBgBm;
int m_nOriginX;
int m_nOriginY;
int m_nColor;
int m_nBgColor;
HBRUSH m_hBrush;
HPEN m_hPen;
};
class CFont
{
public:
typedef enum { THIN, NORMAL, BOLD } FontWeight;
CFont(const char* pFaceName, int nSize, FontWeight tWeight);
~CFont() { ReleaseHandle(); };
void SetFace(const char* pFaceName);
void SetHeight(int nSize);
void SetWeight(FontWeight tWeight);
void SetItalic(BOOL bFlag);
void SetUnderline(BOOL bFlag);
void SetStrikeOut(BOOL bFlag);
HFONT GetFont();
private:
void ReleaseHandle();
LOGFONT m_oLogFont;
HFONT m_hFont;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -