Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - HOWTO: Increase number of used colors in TabCtrl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

HOWTO: Increase number of used colors in TabCtrl

 Post Reply Post Reply
Author
Message
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 Topic: HOWTO: Increase number of used colors in TabCtrl
    Posted: 08 March 2018 at 10:10am
Hi;

How can I increase the number of colors used in colored tab controls when using OneNoteColors?
Now the color is repeated after 8 tabs (see screenshot).


If this is not possible with OneNoteColors, how can I get colored tabs in another way?

TIA
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
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 14 March 2018 at 7:48am
Hello Martin,

These colors defined in static method CXTPTabPaintManager::GetOneNoteColor(XTPTabOneNoteColor). You can increase number of colors  by adding new constants in enum XTPTabOneNoteColor.
enum XTPTabOneNoteColor
{
    xtpTabColorBlue    = 0x1000000, // Blue tab color used when OneNote colors enabled.
    xtpTabColorYellow  = 0x1000001, // Yellow tab color used when OneNote colors enabled.
    xtpTabColorGreen   = 0x1000002, // Green tab color used when OneNote colors enabled.
    xtpTabColorRed     = 0x1000003, // Red tab color used when OneNote colors enabled.
    xtpTabColorPurple  = 0x1000004, // Purple tab color used when OneNote colors enabled.
    xtpTabColorCyan    = 0x1000005, // Cyan tab color used when OneNote colors enabled.
    xtpTabColorOrange  = 0x1000006, // Orange tab color used when OneNote colors enabled.

    xtpTabColorNew    = 0x1000007, // Orange tab color used when OneNote colors enabled.

    xtpTabColorMagenta = 0x1000008  // Magenta tab color used when OneNote colors enabled.
};

Leave color xtpTabColorMagenta as last  to prevent changes in CXTPTabClientWnd::CWorkspace::GetItemColor() and CXTPTabManager::GetItemColor()

As other way you can change these two methods to return custom colors.

Also as the easyest way  you can set custom color right to CXTPTabManagerItem::m_clrItem. (CXTPTabManagerItem::SetColor(COLORREF)) If that value will be from 0x1000000 to 0x1000007  then it means predefined colors from xtpTabColorBlue to xtpTabColorMagenta. Other values will be used directly as colors.
See Samples\ToolkitPro\MDITabWindow\ChildWnd.cpp  CChildWnd::OnGetTabColor()

Regards,
 Oleksandr Lebed
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.172 seconds.