123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #include "stdafx.h"
- #include "WinXPButtonST.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- CWinXPButtonST::CWinXPButtonST()
- {
-
- m_bIsRounded = FALSE;
- }
- CWinXPButtonST::~CWinXPButtonST()
- {
- }
- DWORD CWinXPButtonST::OnDrawBorder(CDC* pDC, CRect* pRect)
- {
- return BTNST_OK;
- }
- DWORD CWinXPButtonST::OnDrawBackground(CDC* pDC, CRect* pRect)
- {
- if (!m_bMouseOnButton && !m_bIsPressed)
- return BASE_BUTTONST::OnDrawBackground(pDC, pRect);
-
- CBrush brushBK(m_crColors[BTNST_COLOR_BK_IN]);
- CBrush* pOldBrush = pDC->SelectObject(&brushBK);
-
- CPen penBorder;
- penBorder.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
- CPen* pOldPen = pDC->SelectObject(&penBorder);
- if (m_bIsRounded)
- pDC->RoundRect(pRect, CPoint(8, 8));
- else
- pDC->Rectangle(pRect);
-
- pDC->SelectObject(pOldBrush);
- pDC->SelectObject(pOldPen);
- return BTNST_OK;
- }
- DWORD CWinXPButtonST::SetRounded(BOOL bRounded, BOOL bRepaint)
- {
- m_bIsRounded = bRounded;
- if (bRepaint) Invalidate();
- return BTNST_OK;
- }
- #undef BASE_BUTTONST
|