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

  • SEARCH
  • Home
  • 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 4609738
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:01:54+00:00 2026-05-22T01:01:54+00:00

Please see the attached screenshot which illustrates a TToolBar from one of my programs:

  • 0

Please see the attached screenshot which illustrates a TToolBar from one of my programs:

enter image description here

Notice the last two images of the Toolbar, they are disabled. The way they have been drawn to appear disabled is not very appealing, in fact in the Delphi IDE some of the images look the same.

The issue I have with it is I want my application to look a lot cleaner. The way the disabled items are drawn doesn’t look very good. The TToolBar allows to set a disabled TImageList, I tried making my images black & white but they didn’t look right, and would rather not have to always make the images black and white (time and effort). This problem also shows in my menus and popup menus, which don’t allow for disabled images anyway.

Is there a way to paint the disabled items to look better on the eye?

If possible I would rather not look to use 3rd Party Controls. I know the Jedi Components allow disabled images for the menu etc, but would prefer a way to not resort too 3rd Party Components, when possible I would much prefer to use the standard issue VCL, especially as sometimes I use the TActionMainMenuBar to draw Office Style menus, which match the TToolBar when DrawingStyle is set to gradient.

EDIT

I have accepted RRUZ’s answer, is it possible though to accept David’s answer as well, both are very good answers and would like the answer to be shared between them if possible.

Thanks.

  • 1 1 Answer
  • 2 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-22T01:01:55+00:00Added an answer on May 22, 2026 at 1:01 am

    Sometime Ago i wrote a patch to fix this behavior. the key is patch the code of the TCustomImageList.DoDraw function, the technique used is similar to the used by the delphi-nice-toolbar app, but instead of patch a bpl IDE in this case we patch the function in memory.

    Just include this unit in your project

    unit uCustomImageDrawHook;
    
    interface
    
    uses
      Windows,
      SysUtils,
      Graphics,
      ImgList,
      CommCtrl,
      Math;
    
    implementation
    
    type
      TJumpOfs = Integer;
      PPointer = ^Pointer;
    
      PXRedirCode = ^TXRedirCode;
      TXRedirCode = packed record
        Jump: Byte;
        Offset: TJumpOfs;
      end;
    
      PAbsoluteIndirectJmp = ^TAbsoluteIndirectJmp;
      TAbsoluteIndirectJmp = packed record
        OpCode: Word;
        Addr: PPointer;
      end;
    
    
      TCustomImageListHack = class(TCustomImageList);
    
    var
      DoDrawBackup   : TXRedirCode;
    
    function GetActualAddr(Proc: Pointer): Pointer;
    begin
      if Proc <> nil then
      begin
        if (Win32Platform = VER_PLATFORM_WIN32_NT) and (PAbsoluteIndirectJmp(Proc).OpCode = $25FF) then
          Result := PAbsoluteIndirectJmp(Proc).Addr^
        else
          Result := Proc;
      end
      else
        Result := nil;
    end;
    
    procedure HookProc(Proc, Dest: Pointer; var BackupCode: TXRedirCode);
    var
      n: DWORD;
      Code: TXRedirCode;
    begin
      Proc := GetActualAddr(Proc);
      Assert(Proc <> nil);
      if ReadProcessMemory(GetCurrentProcess, Proc, @BackupCode, SizeOf(BackupCode), n) then
      begin
        Code.Jump := $E9;
        Code.Offset := PAnsiChar(Dest) - PAnsiChar(Proc) - SizeOf(Code);
        WriteProcessMemory(GetCurrentProcess, Proc, @Code, SizeOf(Code), n);
      end;
    end;
    
    procedure UnhookProc(Proc: Pointer; var BackupCode: TXRedirCode);
    var
      n: Cardinal;
    begin
      if (BackupCode.Jump <> 0) and (Proc <> nil) then
      begin
        Proc := GetActualAddr(Proc);
        Assert(Proc <> nil);
        WriteProcessMemory(GetCurrentProcess, Proc, @BackupCode, SizeOf(BackupCode), n);
        BackupCode.Jump := 0;
      end;
    end;
    
    
    procedure Bitmap2GrayScale(const BitMap: TBitmap);
    type
      TRGBArray = array[0..32767] of TRGBTriple;
      PRGBArray = ^TRGBArray;
    var
      x, y, Gray: Integer;
      Row       : PRGBArray;
    begin
      BitMap.PixelFormat := pf24Bit;
      for y := 0 to BitMap.Height - 1 do
      begin
        Row := BitMap.ScanLine[y];
        for x := 0 to BitMap.Width - 1 do
        begin
          Gray             := (Row[x].rgbtRed + Row[x].rgbtGreen + Row[x].rgbtBlue) div 3;
          Row[x].rgbtRed   := Gray;
          Row[x].rgbtGreen := Gray;
          Row[x].rgbtBlue  := Gray;
        end;
      end;
    end;
    
    
    //from ImgList.GetRGBColor
    function GetRGBColor(Value: TColor): DWORD;
    begin
      Result := ColorToRGB(Value);
      case Result of
        clNone:
          Result := CLR_NONE;
        clDefault:
          Result := CLR_DEFAULT;
      end;
    end;
    
    
    procedure New_Draw(Self: TObject; Index: Integer; Canvas: TCanvas; X, Y: Integer; Style: Cardinal; Enabled: Boolean);
    var
      MaskBitMap : TBitmap;
      GrayBitMap : TBitmap;
    begin
      with TCustomImageListHack(Self) do
      begin
        if not HandleAllocated then Exit;
        if Enabled then
          ImageList_DrawEx(Handle, Index, Canvas.Handle, X, Y, 0, 0, GetRGBColor(BkColor), GetRGBColor(BlendColor), Style)
        else
        begin
          GrayBitMap := TBitmap.Create;
          MaskBitMap := TBitmap.Create;
          try
            GrayBitMap.SetSize(Width, Height);
            MaskBitMap.SetSize(Width, Height);
            GetImages(Index, GrayBitMap, MaskBitMap);
            Bitmap2GrayScale(GrayBitMap);
            BitBlt(Canvas.Handle, X, Y, Width, Height, MaskBitMap.Canvas.Handle, 0, 0, SRCERASE);
            BitBlt(Canvas.Handle, X, Y, Width, Height, GrayBitMap.Canvas.Handle, 0, 0, SRCINVERT);
          finally
            GrayBitMap.Free;
            MaskBitMap.Free;
          end;
        end;
      end;
    end;
    
    procedure HookDraw;
    begin
      HookProc(@TCustomImageListHack.DoDraw, @New_Draw, DoDrawBackup);
    end;
    
    procedure UnHookDraw;
    begin
      UnhookProc(@TCustomImageListHack.DoDraw, DoDrawBackup);
    end;
    
    
    initialization
     HookDraw;
    finalization
     UnHookDraw;
    end.
    

    and the result will be

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see attached image alt text http://img248.imageshack.us/img248/7743/datefrom.png I have a table which have FromDate
... with a button outside of the uiwebview? please see screenshot attached. the thing
Please see the attached image. I'm trying to change the color on the segmented
Please see attached picture to better understand my question i have a matrix of
Please see attached image. alt text http://img241.imageshack.us/img241/3585/customcost.png Can you please tell me what query
Please see the attached image: 1) I downloaded a new library here: ( http://www.java2s.com/Code/Jar/ABC/Downloadcommonslang24jar.htm
I am new in android development.Please see the Attached image also Please check this
How can i place values on the 'google.visualization' graph ? please see image attached.
Please see the code below. I am trying to draw a circle around a
Please see the code below <html xmlns=http://www.w3.org/1999/xhtml> <head> <title>Test</title> </head> <body> <div> ¿Hola cómo

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.