44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#include "stdafx.h"
|
|
#include "shsFlatButton.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
CHYFlatButton::CHYFlatButton()
|
|
{
|
|
bRaised = FALSE;
|
|
bPushed = FALSE;
|
|
}
|
|
|
|
void CHYFlatButton::Paint(CDC* pDC)
|
|
{
|
|
CRect rc = GetRect();
|
|
|
|
if (bPushed)
|
|
pDC->Draw3dRect(rc, ::GetSysColor(COLOR_BTNSHADOW),
|
|
::GetSysColor(COLOR_BTNHIGHLIGHT));
|
|
else
|
|
if (bRaised)
|
|
pDC->Draw3dRect(rc, ::GetSysColor(COLOR_BTNHIGHLIGHT),
|
|
::GetSysColor(COLOR_BTNSHADOW));
|
|
|
|
COLORREF clrOldTextColor = pDC->GetTextColor();
|
|
pDC->SetTextColor(::GetSysColor(COLOR_BTNTEXT));
|
|
int nPrevBkMode = pDC->SetBkMode(TRANSPARENT);
|
|
CFont font;
|
|
int ppi = pDC->GetDeviceCaps(LOGPIXELSX);
|
|
int pointsize = MulDiv(60, 96, ppi); // 6 points at 96 ppi
|
|
font.CreatePointFont(pointsize, _T("Marlett"));
|
|
CFont* oldfont = pDC->SelectObject(&font);
|
|
|
|
pDC->TextOut(ptOrg.x + 3, ptOrg.y + 3, CString(_T("r"))); // x-like
|
|
|
|
pDC->SelectObject(oldfont);
|
|
pDC->SetBkMode(nPrevBkMode);
|
|
pDC->SetTextColor(clrOldTextColor);
|
|
}
|
|
|