Nice idea, @chkaufmann and nglthach.
I had to change it around a little to get it to work, as I instantiate the menu items at runtime.
Since I don't assign an OnClick handler, I don't need to disable the entry.
I mucked around with colors for a while.
Currently using Bold White on DarkGrey which works "ok" for both light and dark themes.
type
TMenuItemGroup = class(TMenuItem)
protected
procedure DoAdvancedDrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect; State: TOwnerDrawState);
public
constructor Create(AOwner: TComponent); override;
end;
constructor TMenuItemGroup.Create(AOwner: TComponent);
begin
Inherited;
OnAdvancedDrawItem := DoAdvancedDrawItem;
end;
procedure TMenuItemGroup.DoAdvancedDrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect; State: TOwnerDrawState);
begin
ACanvas.Brush.Color := TColors.Darkgrey; // TColors.SysHighlight; // TColors.Darkblue;
ACanvas.FillRect(ARect);
ACanvas.Font.Color := TColors.White; // TColors.SysHighlightText; // TColors.White;
ACanvas.Font.Style := [fsBold];
ACanvas.TextRect(ARect, ARect.Left + 3, ARect.Top + 3, StripHotkey(Caption));
end;