其他分享
首页 > 其他分享> > [Win32] HBRUSH 画刷

[Win32] HBRUSH 画刷

作者:互联网

第一种: hbr= CreateSolidBrush(RGB(255,0,0)); //单色的画刷

RGB(r,g,b)
#define RGB(r,g,b)  ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))

第二种: hbr= (HBRUSH)GetStockObject(BLACK_BRUSH); //只能取特定颜色的画刷

画刷类别
#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

第三种: hbr= CreatePatternBrush(HBITMAP hbmp); //得到位图画刷

第四种: hbr = CreateHatchBrush(int fnStyle, COLORREF clrref) //创建一种带阴影的画刷

第五种: hbr= CreateBrushIndirect(LOGBRUSH); //通过LOGBRUSH结构体来取画刷

LOGBRUSH
typedef struct tagLOGBRUSH
  {
    UINT        lbStyle;
    COLORREF    lbColor;
    ULONG_PTR   lbHatch;
  } LOGBRUSH

第六种: hbr= HBRUSH CreateDIBPatternBrush(HGLOBAL hglbDIBPacked,UINT fuColorSpec);

标签:画刷,LOGBRUSH,Win32,RGB,BLACK,BRUSH,define,HBRUSH,hbr
来源: https://www.cnblogs.com/YHFBlogs/p/16026054.html