namespace win32 { namespace gui { class color_painter : public painter_base { public: typedef LOGBRUSH param0; typedef LOGPEN param1; // c'tor color_painter(); color_painter(LOGBRUSH brush); color_painter(LOGBRUSH brush, LOGPEN pen); // virtual functions of painter_base color_painter* clone() const; void draw(HDC hDC, int cx, int cy); bool is_opaque(int cx, int cy) const; // own functions void brush(LOGBRUSH brush); LOGBRUSH brush() const; void pen(LOGPEN pen); LOGPEN pen() const; static LOGBRUSH make_brush(COLORREF cr = GetSysColor(COLOR_WINDOW), unsigned style = BS_SOLID, long hatch = 0); static LOGPEN make_pen(COLORREF cr = GetSysColor(COLOR_WINDOWTEXT), unsigned style = PS_SOLID, unsigned width = 1); }; } } // namespace win32::gui
make_brush() / make_pen()) make_brush() and make_pen() are functions for convenience to setup a LOGBRUSH and LOGPEN very fastCOLORREF cr_blue = RGB(0, 0, 150);
COLORREF cr_black = RGB(0, 0, 0);
add_painter<color_painter> ( color_painter::make_brush(cr_blue),
color_painter::make_pen(cr_black, PS_SOLID, 50) );
The result is as follows
|
by Steven Weiss. You can contact me at steven11@gmx.de. |