Jump to content
Sign in to follow this  
shineworld

Change Scroll bar color

Recommended Posts

Hi all,

I've already used Themes, with satisfaction, on some little applications.

In a big application, I haven't used the TStyleManager.Engine because too hard to re-design the entire application,

but I would like to have a way to style only the scrollbars colors of a TSynEdit component.

 

It is, in some way, possible to add ONLY the TScrollingStyleHook behavior in a program without the Style engine running?

Thank you for your suggenstions!
 

Share this post


Link to post

I've already added Style in TSynEdit and it is very simple to do.
For example, to add the Scrollbar style is only necessary to add this line:

uses
  Vcl.Themes;

{$R *.dfm}

procedure TForm8.FormCreate(Sender: TObject);
begin
  TStyleManager.Engine.RegisterStyleHook(TCustomSynEdit, TScrollingStyleHook);
end;

image.thumb.png.3432c7fddc76e5605d665454f99b33da.png
 

But I don't would to enable styling in all my project BUT only to SynEdit scrollbar so this is not a way to follow.

Perhaps I need to study a way to "extract" what Vcl.Theme manager does for TScrollingStyleHook and to apply only to my version of TCustomSynEdit...

Unfortunately, the entire project already living with an old theme system (Light/Dark), and now I can't change it.

Share this post


Link to post

Any idea on how to "force" the scrollbar colors?
With dark mode are very very ugly:
image.thumb.png.c5166c7dc2bdbc9d527dff5ae41c3f3a.png

I've googled a lot searching for a way to use TThemeManager forcing it only to a component without results...

Share this post


Link to post
15 hours ago, shineworld said:

Any idea on how to "force" the scrollbar colors?
With dark mode are very very ugly:
image.thumb.png.c5166c7dc2bdbc9d527dff5ae41c3f3a.png

I've googled a lot searching for a way to use TThemeManager forcing it only to a component without results...

try to add TScrollbar and make it related with that SynEdit and finally you will have a completely separated scrollbar with StyleElement property

don't forget to make Scrollbars property to ssNone for your SynEdit

Edited by bravesofts

Share this post


Link to post

Checking Vcl.Forms.pas, it registers both TCustomForm and TForm to the style engine.

Does it help if you call

TStyleManager.Engine.RegisterStyleHook(TSynEdit, TScrollingStyleHook);

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×