-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpecialEdit.cpp
61 lines (49 loc) · 1.25 KB
/
SpecialEdit.cpp
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
// SpecialEdit.cpp : implementation file
//
#include "stdafx.h"
#include "Unfrag.h"
#include "SpecialEdit.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSpecialEdit
CSpecialEdit::CSpecialEdit()
{
m_brush.CreateSolidBrush (::GetSysColor (COLOR_WINDOW));
}
CSpecialEdit::~CSpecialEdit()
{
}
BEGIN_MESSAGE_MAP(CSpecialEdit, CEdit)
//{{AFX_MSG_MAP(CSpecialEdit)
ON_WM_SETFOCUS()
ON_WM_KILLFOCUS()
//}}AFX_MSG_MAP
ON_WM_CTLCOLOR_REFLECT ()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSpecialEdit message handlers
void CSpecialEdit::OnSetFocus(CWnd* pOldWnd)
{
CEdit::OnSetFocus(pOldWnd);
SetSel (-1, 0);
HideCaret ();
}
BOOL CSpecialEdit::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= ES_READONLY; // Make sure this bit is set...
cs.style &= ~ES_NOHIDESEL; // and this one is clear
return CEdit::PreCreateWindow(cs);
}
void CSpecialEdit::OnKillFocus(CWnd* pNewWnd)
{
CEdit::OnKillFocus(pNewWnd);
ShowCaret ();
}
HBRUSH CSpecialEdit::CtlColor (CDC* pDC, UINT nCtlColor)
{
return (HBRUSH) m_brush;
}