74 COLORREF m_transColor;
79 UINT m_bitmapChangeTime;
80 CPoint m_pushedOffset;
81 enum { TIMERID_DRAW = 1 };
83 void m_DeleteRgn(HRGN& _hRgn)
91 void m_DeleteRgns(
void)
93 if ( ::IsWindow(m_hWnd) )
95 _super::SetWindowRgn(NULL,
false);
97 m_DeleteRgn(m_hRgnClip);
98 m_DeleteRgn(m_hRgnCtrl);
100 void m_SetRgn(HRGN& _hRgn, HRGN h)
103 _hRgn = ::CreateRectRgn(0, 0, 1, 1);
104 ::CombineRgn(_hRgn, h, NULL, RGN_COPY);
109 if ( h.GetSize(m_size) )
115 m_SetRgn(m_hRgnCtrl, m_hRgnClip);
116 m_boIsDoSetRgn =
true;
117 _super::SetWindowPos(NULL, 0, 0, m_size.cx, m_size.cy, SWP_NOZORDER | SWP_NOMOVE);
118 _super::SetWindowRgn(NULL,
true);
126 if ( hb == NULL ) {
return; }
128 CPoint pos2((_super::GetButtonState() ==
ES_Pushed) ? m_pushedOffset : pos1);
132 hb.
Draw(*pDC, pos1.x, pos1.y);
140 ::TransparentBlt(*pDC, pos2.x, pos2.y, s.cx, s.cy, hdc, 0, 0, s.cx, s.cy,
m_focusMaskColor);
182 _super::KillTimer(TIMERID_DRAW);
188 else if ( m_bitmapChangeTime == 0 || hb.
IsNull() )
195 VERIFYLIB( bi.
Set(hb) );
200 _super::SetTimer(TIMERID_DRAW, m_bitmapChangeTime, NULL);
213 virtual LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
215 if ( message == WM_PAINT )
217 if ( m_boIsDoSetRgn )
219 m_boIsDoSetRgn =
false;
220 _super::SetWindowRgn(m_hRgnCtrl,
true);
222 _super::RedrawWindow();
226 else if ( message == WM_SHOWWINDOW )
228 m_lastBitmap.
Empty();
230 else if ( message == WM_DESTROY )
234 else if ( message == WM_SETTEXT )
236 CString s =
reinterpret_cast<LPCTSTR
>(lParam);
238 if ( f >= 0 && (f + 1) < s.GetLength() )
243 else if ( message == WM_TIMER && wParam == TIMERID_DRAW )
245 KillTimer(TIMERID_DRAW);
249 return _super::WindowProc(message, wParam, lParam);
259 HBITMAP hBase =
reinterpret_cast<HBITMAP
>(::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_BITMAP, 0L));
270 _super::GetClientRect(rect);
273 HDC dc = ::GetDC(NULL);
274 hBase = ::CreateCompatibleBitmap(dc, rect.Width(), rect.Height());
275 ::ReleaseDC(NULL, dc);
284 _super::PreSubclassWindow();
297 : m_boIsDoSetRgn(false), m_hRgnClip(NULL), m_hRgnCtrl(NULL), m_pushedOffset(0, 0)
298 , m_transColor(CLR_AUTOSELECT),
m_focusMaskColor(CLR_INVALID), m_bitmapChangeTime(40)
311 _super::operator=(other);
312 m_size = other.m_size;
313 m_transColor = other.m_transColor;
314 m_boIsDoSetRgn = other.m_boIsDoSetRgn;
315 m_lastBitmap = other.m_lastBitmap;
316 m_bitmapChangeTime = other.m_bitmapChangeTime;
317 m_pushedOffset = other.m_pushedOffset;
324 m_SetRgn(m_hRgnClip, other.m_hRgnClip);
325 if ( ! ::IsWindow(other) )
327 m_SetRgn(m_hRgnCtrl, other.m_hRgnCtrl);
331 other.GetWindowRgn(m_hRgnCtrl);
334 if ( ::IsWindow(m_hWnd) )
351 m_bitmapChangeTime = ms;
366 if ( bmp.
IsNull() ) {
return false; }
368 m_transColor = color;
369 if ( ::IsWindow(m_hWnd) )
371 if ( ! m_SetBaseBitmap(bmp, color) )
437 if ( ! IS_RGBVALUE(color) )
441 color = ::GetPixel(dc, 0, s.cy - 1);
454 m_pushedOffset = pos;
471 if ( baseImage.
Set(bmp) )
473 CSize baseSize = baseImage.
GetSize();
476 int l = baseSize.cx / 5;
478 for (
int i = 0; i < 5; i++ )
480 bi = baseImage.
Cut(CRect(x, 0, x + l, baseSize.cy));
508 m_DeleteRgn(m_hRgnClip);
509 m_SetRgn(m_hRgnCtrl, h);
510 m_boIsDoSetRgn =
true;
511 _super::RedrawWindow();
#define loop(VAR, CNT)
loop構文.
void SetClone(HBITMAP hBmp)
[設定] HBITMAPセット.
bool Draw(HDC hdc, int x=0, int y=0) const
[処理] イメージ描画.
bool IsEmpty(void) const
[確認] Empty状態確認.
HRGN CreateRgn(COLORREF transColor=CLR_AUTOSELECT) const
[作成] リージョン作成.
HDC GetDC(void)
[取得]デバイスコンテキストハンドル取得.
bool Attach(CBitmapHandle bmp)
[設定] アタッチ.
CBitmapImage Cut(const RECT &rect, int cx=0, int cy=0) const
[取得] イメージ取り出し.
const SIZE & GetSize(void) const
[取得] イメージサイズ取得.
bool Set(int cx, int cy, COLORREF color=CLR_INVALID)
[設定] イメージ設定.
CBitmapHandle GetBitmapHandle(void)
[取得] ビットマップハンドル取得
bool ReleaseDC(void)
[設定] デバイスコンテキストハンドル返却.
bool InsertOnAlphaBlend(int x, int y, const CBitmapImage &bmpimg, int parsent=100, int cx=0, int cy=0)
[挿入] 半透過処理付イメージ挿入.
bool IsNull(void) const
[確認] NULLチェック
int SelectClipRgnOrg(CDC *pDC, HRGN rgn, int mode=RGN_COPY)
[設定] リージョン設定.