Enable Visual Studio 2015 theme to HeaderCtrl |
Post Reply |
Author | |
JoseAngel
Groupie Joined: 21 March 2006 Location: Spain Status: Offline Points: 35 |
Post Options
Thanks(0)
Posted: 11 April 2016 at 8:01am |
I just added Visual Studio 2015 support for HeaderCtrl (maybe it doesn't contemplate all the cases, but for me is enought). If you want to add it, follow the next steps: 1. Add this section to VisualStudio2015Dark.ini
[HeaderCtrl] Back=37 37 38 Border=63 63 70 Text=246 246 246 2. Add this section to VisualStudio2015Light.ini [HeaderCtrl] Back=245 245 245 Border=204 206 219 Text=66 66 66 3. Add this section to VisualStudio2015Blue.ini [HeaderCtrl] Back=246 246 246 Border=204 206 219 Text=66 66 66 4. Compile VisualStudio2015 solution. 5. Add this case in CXTPHeaderCtrl::SetTheme case xtpControlThemeVisualStudio2015: m_pTheme = new CXTPHeaderCtrlThemeVisualStudio2015; break; 6. Add this class definition to XTPHeaderCtrlTheme.h class _XTP_EXT_CLASS CXTPHeaderCtrlThemeVisualStudio2015 : public CXTPHeaderCtrlTheme { public: CXTPHeaderCtrlThemeVisualStudio2015(); virtual ~CXTPHeaderCtrlThemeVisualStudio2015(); protected: virtual void RefreshMetrics(CXTPHeaderCtrl* pHeader); virtual void OnDrawBackground(LPDRAWITEMSTRUCT lpDIS); virtual void OnDrawItemBackground(LPDRAWITEMSTRUCT lpDIS); }; 7. Add this lines to XTPHeaderCtrlTheme.cpp CXTPHeaderCtrlThemeVisualStudio2015::CXTPHeaderCtrlThemeVisualStudio2015() { m_nTheme = xtpControlThemeVisualStudio2015; m_dwDrawStyle = HDR_XTP_SORTARROW; } CXTPHeaderCtrlThemeVisualStudio2015::~CXTPHeaderCtrlThemeVisualStudio2015() { } void CXTPHeaderCtrlThemeVisualStudio2015::RefreshMetrics(CXTPHeaderCtrl* pHeader) { CXTPHeaderCtrlTheme::RefreshMetrics(pHeader); m_cr3DFace = XTPIniColor(_T("HeaderCtrl"), _T("Back"), RGB(37, 37, 38)); m_cr3DHighLight = XTPIniColor(_T("HeaderCtrl"), _T("Border"), RGB(63, 63, 70)); m_crText = XTPIniColor(_T("HeaderCtrl"), _T("Text"), RGB(255, 255, 255)); } void CXTPHeaderCtrlThemeVisualStudio2015::OnDrawBackground(LPDRAWITEMSTRUCT lpDIS) { CRect rcItem(lpDIS->rcItem); CDC* pDC = CDC::FromHandle(lpDIS->hDC); // fill background pDC->FillSolidRect(&rcItem, m_cr3DFace); rcItem.right += 2; // draw bottom border. CXTPPenDC penDC(lpDIS->hDC, m_cr3DHighLight); pDC->MoveTo(rcItem.left, rcItem.bottom - 1); pDC->LineTo(rcItem.right, rcItem.bottom - 1); } void CXTPHeaderCtrlThemeVisualStudio2015::OnDrawItemBackground(LPDRAWITEMSTRUCT lpDIS) { CDC* pDC = CDC::FromHandle(lpDIS->hDC); CXTPPenDC penDC(lpDIS->hDC, m_cr3DHighLight); pDC->MoveTo(lpDIS->rcItem.right - 1, 2); pDC->LineTo(lpDIS->rcItem.right - 1, lpDIS->rcItem.bottom - 2); } And voila. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |