Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7555799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:42:14+00:00 2026-05-30T11:42:14+00:00

I like to use the XPStyle found in TActionManager to create my menu interface.

  • 0

I like to use the XPStyle found in TActionManager to create my menu interface.

One thing I really would like to do without using 3rd Party components is render a gradient along the side of the menu:

enter image description here

XPColorMap does not seem to have the properties needed to change this unless I am overlooking something really obvious.

How may I do this, if at all possible?

Thanks.

UPDATE

Thanks to the excellent information and code sample provided by wp_1233996, here is the result:

enter image description here

I don’t see how this is a nasty XP Style Menu on Windows 7 though? I think it looks really good personally 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:42:16+00:00Added an answer on May 30, 2026 at 11:42 am

    http://edn.embarcadero.com/article/33461 links to a great article by Jeremy North which explains some of the magic behind the actionbars components. My solution is based on this article.

    At first, the class responsible for painting the menu items is the TXPStyleMenuItem (in unit Vcl.XPActnCtrls). Create a new class that inherits from TXPStyleMenuItem and override the DrawBackground method. The new method should be something like this:

    uses
      ..., Vcl.XPActnCtrls, Vcl.GraphUtil, ...;
    
    type
      TMyStyleMenuItem = class(TXPStyleMenuItem)
      protected
        procedure DrawBackground(var PaintRect: TRect); override;
    end;
    
    procedure TMyStyleMenuItem.DrawBackground(var PaintRect: TRect);
    // Some lines are copied from Delphi's TXPStyleMenuItem.DrawBackground.
    var
      BannerRect: TRect;
      StartCol, EndCol: TColor;
    begin
      inherited;
    
      BannerRect := PaintRect;
      BannerRect.Right := 25;
      StartCol := clGray; //or: Actionbar.ColorMap.UnusedColor;
      EndCol := clSilver; //or: Actionbar.ColorMap.Color;
      GradientFillCanvas(Canvas, StartCol, EndCol, BannerRect, gdHorizontal);
    
      if (Selected and Enabled) or (Selected and not MouseSelected) then
      begin
        if Enabled and not ActionBar.DesignMode then
          if not Separator or (Separator and ActionBar.DesignMode) then
            Canvas.Brush.Color := Menu.ColorMap.SelectedColor;
        Dec(PaintRect.Right, 1);
      end;
      if (not ActionBar.DesignMode and Separator) then exit;
      if not Mouse.IsDragging and ((Selected and Enabled) or
         (Selected and not MouseSelected)) then
      begin
        Canvas.FillRect(PaintRect);
        Canvas.Brush.Color := ActionBar.ColorMap.BtnFrameColor;
        Inc(PaintRect.Right);
        Canvas.FrameRect(PaintRect);
      end;
    end;
    

    In this code, the gradient start and end colors are hardcoded. For better flexibility, it might be better to take the colors from the colormap as indicated by the comments.

    In order to use this new class instead of the old XPStyleMenuItem, implement an event handler for the ActionMainMenubar’s event OnGetControlClass:

    procedure TForm1.ActionMainMenuBar1GetControlClass(Sender: TCustomActionBar;
      AnItem: TActionClient; var ControlClass: TCustomActionControlClass);
    begin
      if ControlClass.InheritsFrom(TXPStyleMenuItem) then
        ControlClass := TMyStyleMenuItem;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using AdoNetAppender (SQL server) in my asp.net application and would like use
Possibly really simple question, but I'm new to IronPython. I would like use IronPython
I would really like use the jQuery Validation plugin in my ASP.NET Web Forms
I would really like use the jQuery Validation plugin in my ASP.NET Web Forms
I like to use Emacs' shell mode, but it has a few deficiencies. One
I like to use markdown notation in my subversion commit messages, planning to one
I like to use MySQL to do quantitative analysis and statistics. I would like
I would like to use a language that I am familiar with - Java,
I would like to use something like CLR Profiles on .Net 2.0 to see
I would like use a panel whose children have coordinates specified as percentage of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.