graphics.h
来自「利用电脑练习和进行电台通联CW的软件」· C头文件 代码 · 共 67 行
H
67 行
#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 + =
减小字号Ctrl + -
显示快捷键?