Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - CXTPTabControl - Set single tab color
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPTabControl - Set single tab color

 Post Reply Post Reply
Author
Message
Marco1 View Drop Down
Senior Member
Senior Member


Joined: 16 January 2004
Location: Germany
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marco1 Quote  Post ReplyReply Direct Link To This Post Topic: CXTPTabControl - Set single tab color
    Posted: 27 May 2011 at 6:34am
Problem is to set the color background of a single tab in CXTPTabControl.

Tab control is themed via:
wndTabControl.GetPaintManager()->SetAppearance(xtpTabAppearancePropertyPageFlat);
wndTabControl.GetPaintManager()->SetColor(xtpTabColorOffice2003);
wndTabControl.GetPaintManager()->DisableLunaColors(FALSE);

Now I try setting a single tab backgroud to red via:
wndTabControl.GetItem(3)->SetColor(RGB(0xFF, 0x00, 0x00));

But tab backgroud remains unchanged. Any advice?

Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 27 May 2011 at 7:58am
Hi;

Try to handle

ON_MESSAGE(WM_XTP_GETTABCOLOR, OnGetTabColor)

HTH
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
Marco1 View Drop Down
Senior Member
Senior Member


Joined: 16 January 2004
Location: Germany
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marco1 Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 2011 at 1:31pm
mgampi, thanx, didn't worked as I wanted.

Okay, perhaps this is useful for someone who as a similar problem:

Tab colors only work in "OneNoteColor" mode, so enable this via
wndTabControl.GetPaintManager()->SetOneNoteColors(TRUE);

Then derive your own control and override GetItemColor

class CXTPTabControlEx : public CXTPTabControl
{
public: 
  COLORREF GetItemColor(const CXTPTabManagerItem* pItem) const {
    return pItem->IsSelected() ? GetPaintManager()->GetColorSet()->m_clrButtonSelected : OwnColor here ;
  }
};

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.170 seconds.