#pragma once
|
|
|
// CStaticEx
|
|
class CStaticEx //: public CStatic
|
{
|
// DECLARE_DYNAMIC(CStaticEx)
|
|
public:
|
CStaticEx::CStaticEx()
|
: bCtlColorDef(0)
|
, bTextColorDef(0)
|
{
|
//this->crCtlColor=0x00e0e0e0;
|
//this->crTextColor=0;
|
}
|
|
CStaticEx::~CStaticEx()
|
{
|
}
|
|
private:
|
HBRUSH m_bkBrush;
|
COLORREF crCtlColor;
|
COLORREF crTextColor;
|
public:
|
int bCtlColorDef;
|
public:
|
int bTextColorDef;
|
public:
|
CFont pFont1;
|
|
// Attributes
|
public:
|
// void SetCtlColor(COLORREF color);
|
//IMPLEMENT_DYNAMIC(CStaticEx, CStatic)
|
protected:
|
// DECLARE_MESSAGE_MAP()
|
public:
|
// afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
|
public:
|
// afx_msg HBRUSH CtlColor(CDC* /*pDC*/, UINT /*nCtlColor*/);
|
public:
|
// void SetTextColor(COLORREF color);
|
|
public:
|
// void SetTextSize(int size);
|
|
|
// CStaticEx
|
|
/*
|
BEGIN_MESSAGE_MAP(CStaticEx, CStatic)
|
// ON_WM_CTLCOLOR()
|
ON_WM_CTLCOLOR_REFLECT()
|
END_MESSAGE_MAP()
|
*/
|
|
|
|
|
|
void CStaticEx::SetCtlColor(COLORREF color)
|
{
|
this->crCtlColor=color;
|
this->bCtlColorDef=true;
|
}
|
void CStaticEx::SetTextColor(COLORREF color)
|
{
|
this->crTextColor=color;
|
this->bTextColorDef=true;
|
}
|
|
void CStaticEx::SetTextSize(int size)
|
{
|
//this->crTextColor=color;
|
//this->bTextColorDef=true;
|
pFont1.CreateFont(size,0,0,0,FW_NORMAL,0,0,0,GB2312_CHARSET,0,0,0,0,_T("ËÎÌå"));
|
// this->SetFont(&pFont1,true);
|
// this->GetFont()->();
|
|
}
|
|
// CStaticEx ÏûÏ¢´¦Àí³ÌÐò
|
|
|
|
//HBRUSH CStaticEx::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
//{
|
// HBRUSH hbr = CStatic::OnCtlColor(pDC, pWnd, nCtlColor);
|
//
|
// // TODO: Ôڴ˸ü¸Ä DC µÄÈκÎÊôÐÔ
|
//
|
// // TODO: Èç¹ûĬÈϵIJ»ÊÇËùÐ軱ʣ¬Ôò·µ»ØÁíÒ»¸ö»±Ê
|
//
|
// pDC->SetBkColor(this->BackgroudColour);
|
// // TODO: Return a non-NULL brush if the parent's handler should not be called
|
// ::DeleteObject(m_bkBrush);
|
// m_bkBrush = ::CreateSolidBrush(this->BackgroudColour);
|
// return m_bkBrush;
|
//
|
// return hbr;
|
//}
|
|
HBRUSH CStaticEx::CtlColor(CDC* pDC, UINT nCtlColor)
|
{
|
// TODO: Ôڴ˸ü¸Ä DC µÄÈκÎÊôÐÔ
|
|
// TODO: Èç¹û²»Ó¦µ÷Óø¸¼¶µÄ´¦Àí³ÌÐò£¬Ôò·µ»Ø·Ç¿Õ»±Ê
|
if (this->bTextColorDef)
|
{
|
pDC->SetTextColor(this->crTextColor);
|
}
|
if (this->bCtlColorDef)
|
{
|
pDC->SetBkColor(this->crCtlColor);
|
// TODO: Return a non-NULL brush if the parent's handler should not be called
|
::DeleteObject(m_bkBrush);
|
m_bkBrush = ::CreateSolidBrush(this->crCtlColor);
|
return m_bkBrush;
|
}
|
else if (this->bTextColorDef)
|
{
|
::DeleteObject(m_bkBrush);
|
m_bkBrush = ::CreateSolidBrush(nCtlColor);
|
return m_bkBrush;
|
|
}
|
return NULL;
|
}
|
|
};
|
|