ETNoticeEdit.cpp
818 Bytes
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
// ETNoticeEdit.cpp : ʵÏÖÎļþ
//
#include "stdafx.h"
#include "ETNoticeEdit.h"
// CETNoticeEdit
IMPLEMENT_DYNAMIC(CETNoticeEdit, CEdit)
CETNoticeEdit::CETNoticeEdit()
:m_pFont(NULL)
{
}
CETNoticeEdit::~CETNoticeEdit()
{
}
BEGIN_MESSAGE_MAP(CETNoticeEdit, CEdit)
ON_WM_PAINT()
END_MESSAGE_MAP()
// CETNoticeEdit ÏûÏ¢´¦Àí³ÌÐò
void CETNoticeEdit::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rtClient;
GetClientRect(&rtClient);
dc.FillSolidRect(&rtClient, RGB(255, 0, 0));
if (m_pFont)
{
dc.SelectObject(m_pFont);
}
dc.SetTextColor(RGB(255, 255, 255));
CString sText;
GetWindowText(sText);
dc.DrawText(sText, rtClient, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
__super::OnPaint();
}
void CETNoticeEdit::SetTextFont(CFont *pFont /* = NULL */)
{
m_pFont = pFont;
}