51 CFlatnessDrawer(COLORREF color1, COLORREF color2, COLORREF back = CLR_AUTOSELECT, COLORREF base = CLR_AUTOSELECT, COLORREF work = RGB(255, 255, 255))
52 : m_color1(color1), m_color2(color2), m_back(back), m_base(base), m_work(work)
73 virtual void Draw(HDC dc,
int x = 0,
int y = 0)
const
75 COLORREF base = m_base;
76 COLORREF back = m_back;
77 if ( base == CLR_AUTOSELECT )
79 base = ::GetPixel(dc, x, y +
m_size.cy - 1);
81 if ( ! IS_RGBVALUE(back) )
85 const DWORD CP_ROP = 0xE20746;
86 HBITMAP hBmp = ::CreateBitmap(
m_size.cx,
m_size.cy, 1, 1, NULL);
87 HDC maskDC = ::CreateCompatibleDC(dc);
88 HGDIOBJ oldBmp = ::SelectObject(maskDC, hBmp);
90 COLORREF oldColor = ::SetBkColor(dc, base);
91 ::BitBlt(maskDC, 0, 0,
m_size.cx,
m_size.cy, dc, x, y, SRCCOPY);
92 ::SetBkColor(dc, m_work);
93 ::BitBlt(maskDC, 0, 0,
m_size.cx,
m_size.cy, dc, x, y, NOTSRCERASE);
96 HBRUSH hr = ::CreateSolidBrush(back);
97 ::FillRect(dc, &rc, hr);
100 HBRUSH brush1 = ::CreateSolidBrush(m_color1);
101 HGDIOBJ oldBrush = ::SelectObject(dc, brush1);
102 ::BitBlt(dc, x, y,
m_size.cx,
m_size.cy, maskDC, 0, 0, CP_ROP);
103 ::SelectObject(dc, oldBrush);
104 _DeleteObject(brush1);
105 if ( m_color2 != CLR_INVALID )
107 HBRUSH brush2 = ::CreateSolidBrush(m_color2);
108 HGDIOBJ oldBrush = ::SelectObject(dc, brush2);
109 ::BitBlt(dc, x - 1, y - 1,
m_size.cx,
m_size.cy, maskDC, 0, 0, CP_ROP);
110 ::SelectObject(dc, oldBrush);
111 _DeleteObject(brush2);
113 ::SetBkColor(dc, oldColor);
115 ::SelectObject(maskDC, oldBmp);
116 _DeleteObject(maskDC);
129 return new CFlatnessDrawer(::GetSysColor(COLOR_HIGHLIGHTTEXT), CLR_INVALID, ::GetSysColor(COLOR_HIGHLIGHT), base, work);
141 return new CFlatnessDrawer(::GetSysColor(COLOR_WINDOWTEXT), CLR_INVALID, ::GetSysColor(COLOR_BTNFACE), base, work);
static CFlatnessDrawer * CreateNaSelectedType(COLORREF base=CLR_AUTOSELECT, COLORREF work=RGB(255, 255, 255))
[取得] 非アクティブ選択状態設定インスタンス作成.
virtual void Draw(HDC dc, int x=0, int y=0) const
[描画] 描画.
static CFlatnessDrawer * CreateSelectedType(COLORREF base=CLR_AUTOSELECT, COLORREF work=RGB(255, 255, 255))
[取得] アクティブ選択状態設定インスタンス作成.
CFlatnessDrawer(COLORREF color1, COLORREF color2, COLORREF back=CLR_AUTOSELECT, COLORREF base=CLR_AUTOSELECT, COLORREF work=RGB(255, 255, 255))
コンストラクタ.
virtual IDrawable * Clone(void) const
[作成] クローン作成.