Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - Enable Visual Studio 2015 theme to HeaderCtrl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Enable Visual Studio 2015 theme to HeaderCtrl

 Post Reply Post Reply
Author
Message
JoseAngel View Drop Down
Groupie
Groupie


Joined: 21 March 2006
Location: Spain
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote JoseAngel Quote  Post ReplyReply Direct Link To This Post Topic: Enable Visual Studio 2015 theme to HeaderCtrl
    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.





Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.