40 DEFSUPER(CProgressCtrl);
44 CTextProgressCtrl(
void) : m_barColor(::GetSysColor(COLOR_HIGHLIGHT)), m_backColor(::GetSysColor(COLOR_WINDOW))
54 _super::SetWindowText(lpszText);
64 void SetColor(COLORREF barColor, COLORREF backColor)
66 m_barColor = barColor;
67 m_backColor = backColor;
77 void SetFont(CFont* pFont, BOOL bRedraw = TRUE)
79 _super::SetFont(pFont, FALSE);
97 _super::PreSubclassWindow();
110 virtual LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
116 CDC* pDC = CDC::FromHandle(
reinterpret_cast<HDC
>(wParam));
119 OnDrawProgressImage(pDC);
126 OnDrawProgressImage(&dc);
132 m_CreateImage(sz.cx, sz.cy);
138 return _super::WindowProc(message, wParam, lParam);
144 void OnDrawProgressImage(CDC* pDC)
148 int f = _super::GetPos();
151 int xx = f * sz.cx / (m2 - m1);
152 CRect r1(0, 0, xx, sz.cy);
153 m_image2.
Cut(r1).
Draw(pDC->GetSafeHdc());
154 CRect r2(xx, 0, sz.cx, sz.cy);
155 m_image1.
Cut(r2).
Draw(pDC->GetSafeHdc(), xx, 0);
159 void m_Sub(
CBitmapImage& _bi,
int cx,
int cy, COLORREF c1, COLORREF c2)
163 CFont* pFont = dc.SelectObject(GetFont());
168 CRect rc(0, 0, cx, cy);
170 dc.SelectObject(pFont);
174 void m_CreateImage(
int cx = 0,
int cy = 0)
176 if ( cx == 0 || cy == 0 )
183 m_Sub(m_image1, cx, cy, m_barColor, m_backColor);
184 m_Sub(m_image2, cx, cy, m_backColor, m_barColor);
187 COLORREF m_backColor;
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)
[設定] イメージ設定.
bool Draw(HDC hdc, int x=0, int y=0) const
[処理] イメージ描画.
static bool DrawTextRect(RECT &_rect, HDC dc, DWORD drawStyle, const POINT &offset, COLORREF color1, COLORREF color2, LPCTSTR str)
[表示] 範囲文字表示.
void SetWindowText(LPCTSTR lpszText)
[設定] 文字列設定.
CTextProgressCtrl(void)
コンストラクタ
virtual void PreSubclassWindow(void)
[通知] subclassing/unsubclassing functions.
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.
void SetColor(COLORREF barColor, COLORREF backColor)
[設定] カラー設定.
void SetFont(CFont *pFont, BOOL bRedraw=TRUE)
[設定] フォント設定