TAdvToolBar and TAdvMainMenu

Hello,


I have several questions about Toolbar with menu.

1. Is it possible to set up usage of standard Windows theme colors for menu and toolbar buttons?
2. Is it possible to set up the minimal height of ToolBar Button?
  1. We offer a TAdvToolBarOfficeStyler component through which several Windows or Office themes can be chosen
    2. In what context is there an issue you see with the height? The height that is chosen at design-time should be respected & used at runtime.
  1. I'm use AdvToolBarFantasyStyler1 with AdvMenuStyler1 to make it look more native, but AdvToolBarFantasyStyler1 with style=bsWindowsClassic have different colors, than Windows 10. Now I'm trying to get this color from system using DWM functions. May be you can help me to tell right direction for research?

    2. This is screenshot to demonstrate the problem:


the dotted line is added to show that menu and tool buttons have different height of highlighting,
how to make the same height for this? Menu ToolBar and Buttons ToolBar have the same height.
Menu font is Segue UI, size=11. Buttons image size is 16x16


The second question solved now by increasing height of Buttons ToolBar on 2, but this is not intuitive

If you want different colors than the standard styles provided by the TAdvMenuOfficeStyler or TAdvMenuFantasyStyler, you can use the TAdvMenuOfficeStyler, set its style to osCustom and via all TAdvMenuOfficeStyler properties like Background, ButtonAppearance, RootItem, SelectedItem, ... you can fully customize the appearance of the menu to your needs.

Yes, I need different colors than components provides, but this is a system default color and I think this should be available via one of component property.


This is my code, which works now for me:

function SetThemeColor(AStyler: TAdvToolBarFantasyStyler): TColor;
var
  Theme: HTHEME;

  procedure DrawTheme(APartId, AStateId: Integer; out AColor, ABorderColor: TColor);
  var
    Bitmap: Vcl.Graphics.TBitmap;
  begin
    Bitmap := Vcl.Graphics.TBitmap.Create;
    try
      Bitmap.Height := 9;
      Bitmap.Width  := 9;
      DrawThemeBackground(Theme, Bitmap.Canvas.Handle, APartId, AStateId,
                          Rect(0, 0, Bitmap.Width, Bitmap.Height), nil);
      AColor := Bitmap.Canvas.Pixels[5, 5];
      ABorderColor := Bitmap.Canvas.Pixels[0, 5];
    finally
      Bitmap.Free;
    end;
  end;

var
  Color, BorderColor: TColor;
begin
  Theme := OpenThemeData(0, 'MENU');
  if (Theme > 0) then
  try
    DrawTheme(MENU_BARBACKGROUND, MB_ACTIVE, Color, BorderColor);
    if Assigned(AStyler.AdvMenuStyler) then begin
      AStyler.BorderColor := Color;
      AStyler.Color.Color := Color;
      AStyler.Color.ColorTo := clNone;
      AStyler.DockColor.Color := Color;
      AStyler.DockColor.ColorTo := clNone;
//      AStyler.AdvMenuStyler.Background.Color := Color;
//      AStyler.AdvMenuStyler.Background.ColorTo := clNone;
//      AStyler.AdvMenuStyler.IconBar.Color := Color;
//      AStyler.AdvMenuStyler.IconBar.ColorTo := clNone;
    end;

    DrawTheme(MENU_BARITEM, MBI_HOT, Color, BorderColor);
    if Assigned(AStyler.AdvMenuStyler) then begin
      AStyler.AdvMenuStyler.RootItem.HoverColor := Color;
      AStyler.AdvMenuStyler.RootItem.HoverColorTo := clNone;
      AStyler.AdvMenuStyler.RootItem.HoverBorderColor := BorderColor;
    end;
    AStyler.ButtonAppearance.ColorHot := Color;
    AStyler.ButtonAppearance.ColorHotTo := clNone;
    AStyler.ButtonAppearance.BorderHotColor := BorderColor;

    DrawTheme(MENU_BARITEM, MBI_PUSHED, Color, BorderColor);
    if Assigned(AStyler.AdvMenuStyler) then begin
      AStyler.AdvMenuStyler.RootItem.SelectedBorderColor := BorderColor;
      AStyler.AdvMenuStyler.RootItem.SelectedColor := Color;
      AStyler.AdvMenuStyler.RootItem.SelectedColorTo := clNone;
    end;
    AStyler.ButtonAppearance.BorderDownColor := BorderColor;
    AStyler.ButtonAppearance.ColorDown := Color;
    AStyler.ButtonAppearance.ColorDownTo := clNone;

    DrawTheme(MENU_POPUPBACKGROUND, 0, Color, BorderColor);
    if Assigned(AStyler.AdvMenuStyler) then begin
      AStyler.AdvMenuStyler.Background.Color := Color;
      AStyler.AdvMenuStyler.Background.ColorTo := clNone;
      AStyler.AdvMenuStyler.IconBar.Color := Color;
      AStyler.AdvMenuStyler.IconBar.ColorTo := clNone;
      AStyler.AdvMenuStyler.MenuBorderColor := clRed;
    end;

    DrawTheme(MENU_POPUPBORDERS, 0, Color, BorderColor);
    if Assigned(AStyler.AdvMenuStyler) then begin
      AStyler.AdvMenuStyler.MenuBorderColor := BorderColor;

      AStyler.AdvMenuStyler.Separator.Color := BorderColor;
      AStyler.AdvMenuStyler.Separator.ColorTo := clNone;
    end;

//    DrawTheme(MENU_POPUPSEPARATOR, 0, Color, Color);
//    if Assigned(AStyler.AdvMenuStyler) then begin
//      AStyler.AdvMenuStyler.Separator.Color := BorderColor;
//      AStyler.AdvMenuStyler.Separator.ColorTo := clNone;
//    end;

    DrawTheme(MENU_POPUPCHECKBACKGROUND, MCB_NORMAL, Color, BorderColor);
    if Assigned(AStyler.AdvMenuStyler) then begin
      AStyler.AdvMenuStyler.IconBar.CheckBorder := BorderColor;
      AStyler.AdvMenuStyler.IconBar.CheckColor := Color;
      AStyler.AdvMenuStyler.IconBar.CheckColorTo := clNone;
      AStyler.AdvMenuStyler.IconBar.RadioBorder := BorderColor;
      AStyler.AdvMenuStyler.IconBar.RadioColor := Color;
      AStyler.AdvMenuStyler.IconBar.RadioColorTo := clNone;
//    end;
//
//    DrawTheme(MENU_POPUPCHECKBACKGROUND, MCB_NORMAL, Color, BorderColor);
//    if Assigned(AStyler.AdvMenuStyler) then begin
      AStyler.AdvMenuStyler.SelectedItem.CheckBorder := BorderColor;
      AStyler.AdvMenuStyler.SelectedItem.CheckColor := Color;
      AStyler.AdvMenuStyler.SelectedItem.CheckColorTo := clNone;
      AStyler.AdvMenuStyler.SelectedItem.RadioBorder := BorderColor;
      AStyler.AdvMenuStyler.SelectedItem.RadioColor := Color;
      AStyler.AdvMenuStyler.SelectedItem.RadioColorTo := clNone;
    end;

    DrawTheme(MENU_POPUPITEM, MPI_HOT, Color, BorderColor);
    if Assigned(AStyler.AdvMenuStyler) then begin
      AStyler.AdvMenuStyler.SelectedItem.BorderColor := BorderColor;
      AStyler.AdvMenuStyler.SelectedItem.Color := Color;
      AStyler.AdvMenuStyler.SelectedItem.ColorTo := clNone;
    end;
  finally
    CloseThemeData(Theme);
  end;
end;

And also, this is possible to customize border color of the TAdvDockPanel?