// StaticEx.cpp : ʵÏÖÎļþ
|
//
|
#include "pch.h"
|
//#include "stdafx.h"
|
#include "StaticEx.h"
|
|
|
// CStaticEx
|
|
// IMPLEMENT_DYNAMIC(CStaticEx, CStatic)
|
|
CStaticEx::CStaticEx()
|
: bCtlColorDef(0)
|
, bTextColorDef(0)
|
{
|
//this->crCtlColor=0x00e0e0e0;
|
//this->crTextColor=0;
|
}
|
|
CStaticEx::~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;
|
this->RedrawWindow();
|
}
|
|
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;
|
}
|
|