TAdvToolbarPager: Color of Caption background

I can not set color of the caption in my TAdvToolbarPager component.
I have assigned TAdvToolbarOfficeStyler to it to control its appearance.
TAdvToolbarPage has UIStyle set to tsCustom.

I try to set Caption background to MyColor (TBStyler is TAdvToolbarOfficeStyler):
TBStyler.PagerCaption.Color := MyColor;
TBStyler.PagerCaption.ColorTo := MyColor;
TBStyler.PagerCaption.ColorMirror := MyColor;
TBStyler.PagerCaption.ColorMirrorTo := MyColor;


But nothing changes. It was working correctly in previous versions of TMS VCL UI Pack.
Should I set something to make it work again?

We could reproduce this and we're investigating.

If you want to set custom colors to your pager it is important to set the UIStyle of the TAdvToolbarPager to tsCustom. But the style of the TAdvToolbarOfficeStyler to bsCustom as well.

This is an example project where the caption colors are set.
PagerCaptionColor.zip (55.4 KB)

Thank you for your answer.

It allows to change the color of the caption, but the ribbon looks ancient and ugly (gradients, borders, 3D, etc.).

I need to leave modern look of the Ribbon. That is why I set Style to bsOffice2016White. But when I switch it to the bsCustom, the color can not be changed.

Why is it so important? Because users of our software used to recognize their individual profile by color of the page caption: one user has green caption like in MS Excel. Another one has blue one - like in MS Word. When the system is in service mode, the caption is orange etc. It was working for many years and now many of our customers started to make errors, because all of them have the same color of the interface and they forget to relog to their individual profile.

Could you repair it or help me to find another solution?

Could it be a solution for your problem to set the TAdvToolBarOfficeStyler to bsOffice2016White and set the AppColor.AppButtonColor to the preferred user color? (I do notice that there is no visible change in design-time, but it works in run-time)

I have performed some tests.

I think I know, where the error appears.

To hide standard Windows caption, TMS recommends to use TAdvToolBarForm instead of TForm as base class. But if you use it, the Page caption is white.

I attach your example, but created on TAdvToolBarForm.

AdvTBTest2.zip (55.5 KB)

The cause for this is that older styles use the internal drawing of Windows. Therefor you get the same form style as your other Windows applications and we can't change the look of this internal working.
In the newer versions this is done manually, it is however not feasible to implement this to work for the older versions and bsCustom.

Did you try the answer I proposed above to use the AppColor.AppButtonColor if you set the TAdvToolBarOfficeStyler to bsOffice2016White?

This will be the best solution for your problem.

Thank you,

I change the style to bsCustom, then I set AppButtonColor to desired color and I set style again to bsOffice2016White and it works ok!


I still strugle to ger the color for the toolbar - I'm trying to get the caption and tab background to a different color (in the example - blue):

(The picture is a quick paint sketch)

But the problem is that the color is always white.

Set AdvToolBarOfficeStyler.Style = ssCustom & AdvToolBarPager.UIStyle = tsCustom
and then
AdvToolBarOfficeStyler.CaptionAppearance.CaptionColor* = clBlue;
AdvToolBarOfficeStyler.PageAppearance.Color* = clBlue;

I tried, but there is no change after the code executes. To be sure, I provide what I changed.

Note: AdvToolBarOfficeStyler.Style = ssCustom doesn't compile, I used bsCustom.

My code:

      pageMain: TAdvToolBarPager;
      pageMain.ToolBarStyler = styleToolbars;


      pageMain.UIStyle := AdvStyleIF.tsCustom;
      styleToolbars.Style := AdvToolBarStylers.bsCustom;
      styleToolbars.CaptionAppearance.CaptionColor := clBlue;
      styleToolbars.PageAppearance.Color := clBlue;

Should I also call some procedure to update the toolbars?

Sorry, it should be:

AdvToolBarPager1.UIStyle := tsCustom;
AdvToolBarOfficeStyler1.Style := bsCustom;
AdvToolBarOfficeStyler1.TabAppearance.Background.Color := clRed;
AdvToolBarOfficeStyler1.TabAppearance.Background.ColorTo := clRed;

Sorry, but it just doesn't work. I tried with a small application to recheck, but it's the same - nothing happens after the code you provided. I tried other things, but I'm just stuck :frowning:

I can send you the test app if you want.

One note: It's not working in design mode also.

But I found that if I change at design-time the property AdvToolBarOfficeStyler1.Style to bsCustom, then the color is changed at run-rime.

Found the solution! :slight_smile:
On the end i needed to add this code


1 Like

Well... I'm on the finish straight, missing just one more thing - I can't change the color of the pager caption on the top of the form (see the arrow).


I tried with

styleToolbars.CaptionAppearance.CaptionColor := clRed;
styleToolbars.CaptionAppearance.CaptionColorTo := clRed;

but no luck.

Could you please help me with this task?

From Windows 10, Windows 11, this has now, consistent with Windows itself, the Windows caption color.

Thanks for the reponse. I use Windows 11 and if I set to

pageMain.UIStyle := AdvStyleIF.tsOffice2019Gray;
styleToolbars.Style := AdvToolBarStylers.bsOffice2019Gray;

then the caption color is dark, even if Windows has other windows in white color (pic below)


but when set to

pageMain.UIStyle := AdvStyleIF.tsCustom;
styleToolbars.Style := AdvToolBarStylers.bsCustom;

then I can't set the caption to a color I wish. Or maybe I'm setting the wrong property? Is correct to set

styleToolbars.CaptionAppearance.CaptionColor := clRed;
styleToolbars.CaptionAppearance.CaptionColorTo := clRed;

for setting the color of the top part of the pager?


Any suggestions..? :)

At this moment, it is overridden to be either the Windows standard caption border look or the selected Office style look (white/gray/black).