MFC-GetStockObject获取库存对象
库存对象
画刷
#define WHITE_BRUSH 0 //白色画刷
#define LTGRAY_BRUSH 1 //亮灰色画刷
#define GRAY_BRUSH 2 //灰色画刷
#define DKGRAY_BRUSH 3 //暗灰色画刷
#define BLACK_BRUSH 4 //黑色画刷
#define NULL_BRUSH 5 //空画刷
#define HOLLOW_BRUSH= NULL_BRUSH
画笔
#define WHITE_PEN 6 白色画笔
#define BLACK_PEN 7 黑色画笔
#define NULL_PEN 8 空画笔
字体
#define OEM_FIXED_FONT 10
#define ANSI FIXED FONT 11
#define ANSI_VAR_FONT 12
#define SYSTEM_FONT 13 系统默认字体
#define DEVICE_DEFAULT_FONT 14 windows默认文本字体
#define DEFAULT_PALETTE 15
#define SYSTEM_FIXED_FONT 16
#define DEFAULT_GUL FONT 17
实例
HDC hdc = ::GetDC(m_hWnd); RECT rect = { 10,10,50,100 }; HBRUSH hbr; hbr = CreateSolidBrush(RGB(255, 0, 0)); hbr=(HBRUSH)GetStockObject(2);//获取库存对象 /* 参数:库存对象代码 返回值:HGDIOBJ */ int f = FrameRect(hdc, &rect, hbr); DeleteObject(hbr); ::ReleaseDC(m_hWnd, hdc);