|
// MyStatic.cpp : implementation file
//
#include "stdafx.h"
#include "HiJack.h"
#include "MyStatic.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyStatic
CMyStatic::CMyStatic()
{
m_nAlign = DT_LEFT;
}
CMyStatic::~CMyStatic()
{
}
BEGIN_MESSAGE_MAP(CMyStatic, CStatic)
//{{AFX_MSG_MAP(CMyStatic)
ON_WM_CTLCOLOR()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyStatic message handlers
HBRUSH CMyStatic::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CStatic::OnCtlColor(pDC, pWnd, nCtlColor);
if(pDC) {
pDC->SetBkMode( TRANSPARENT );
}
return hbr;
}
void CMyStatic::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rect;
GetWindowRect(rect);
ScreenToClient(rect);
dc.FillSolidRect( rect, ::GetSysColor( COLOR_3DFACE ) );
CFont* pFont = GetFont();
CFont* pOldFont = (CFont*)dc.SelectObject(pFont);
CString szText;
GetWindowText(szText);
dc.DrawText( szText, rect, m_nAlign|DT_EDITCONTROL|DT_WORDBREAK );
dc.SelectObject( pOldFont );
}
void CMyStatic::SetAlign(int nAlign)
{
m_nAlign = nAlign;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I started to write software since 1999 and have developed various products including security solutions and system utilities.
Microsoft Visual C++ MVP
Assistant Professor at the University of Virginia
Website: http://yongkwon.info