QuakeGod
2021-06-20 4b03ae5cf77da35e8cf7a7c4b508bba09307cc3a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#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;
}
 
};