Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

color_painter

color_painter is a simple painter which draws a plain rectangle. You can specify the LOGBRUSH and LOGPEN which are used to draw the rectangle.

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

Note:


Example:
COLORREF 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

color_painter.jpg



by Steven Weiss. You can contact me at steven11@gmx.de.