forked from apex-hughin/CrimsonEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VerticalStatic.cpp
67 lines (53 loc) · 1.47 KB
/
VerticalStatic.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
62
63
64
65
66
67
// VerticalStatic.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "VerticalStatic.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CVerticalStatic
CVerticalStatic::CVerticalStatic()
{
}
CVerticalStatic::~CVerticalStatic()
{
}
BEGIN_MESSAGE_MAP(CVerticalStatic, CStatic)
//{{AFX_MSG_MAP(CVerticalStatic)
ON_WM_PAINT()
ON_WM_SIZE()
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVerticalStatic message handlers
void CVerticalStatic::OnPaint()
{
CPaintDC dc(this); // device context for painting
RECT rect; GetClientRect( & rect );
CString szText; GetWindowText(szText);
LOGFONT lf; CFont * pFont = GetFont();
pFont->GetLogFont( & lf ); lf.lfEscapement = 900;
CFont font; font.CreateFontIndirect( & lf );
dc.IntersectClipRect( & rect );
CFont * pFontSave = dc.SelectObject( & font );
dc.SetBkMode( TRANSPARENT );
CSize size = dc.GetTextExtent( szText );
dc.FillSolidRect( & rect, GetSysColor(COLOR_BTNFACE) );
dc.SetTextColor( GetSysColor(COLOR_BTNTEXT) );
dc.TextOut( rect.left + 4, rect.bottom - 2, szText );
dc.SelectObject(pFontSave);
}
void CVerticalStatic::OnSize(UINT nType, int cx, int cy)
{
CStatic::OnSize(nType, cx, cy);
Invalidate(TRUE);
}
BOOL CVerticalStatic::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}