Search code examples
delphitooltipshadowdelphi-10-seattle

Hide DropShadow from Hints


In my application i want to use hints to show additional information.

It looks like this:

enter image description here

I noticed that Firefox shows hints without the dropshadow:

enter image description here

My research on google only brought me to questions about adding a dropshadow (XP days) and not removing them.

So my question is: How can i remove the dropshadow from hints? Thanks.


Solution

  • You just create your own hint window class inheriting from THintWindow, remove CS_DROPSHADOW in CreateParams and then set vcl to use your class instead of default.

    TMyHintWindow = class(THintWindow)
    protected
      procedure CreateParams(var Params: TCreateParams); override;
    end;
    
    procedure TMyHintWindow.CreateParams(var Params: TCreateParams);
    begin
      inherited CreateParams(Params);
      Params.WindowClass.Style := Params.WindowClass.style and not CS_DROPSHADOW;
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      FOldHint := HintWindowClass;
      HintWindowClass := TMyHintWindow;
      // FOldHint is type of THintWindowClass;
      // If you like to reset hint window to its original value you just set it back to FOldHint
      // HintWindowClass := FOldHint;
    end;