Recent

Author Topic: Drawing or Changing scroll bar color on SynEdit  (Read 2315 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Drawing or Changing scroll bar color on SynEdit
« on: May 15, 2019, 02:54:56 pm »
I am making an program that uses SynEdit.
The background color is black with colored text

However, the light gray (default) scrollbar color stands out to much, Is there an easy way to color the vert/horizontal scrollbars?? to a "clGray" color?
« Last Edit: May 20, 2019, 11:59:00 am by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Drawing or Changing scroll bar color on SynEdit
« Reply #1 on: May 15, 2019, 03:36:50 pm »
They are drawn by the OS, according to the OS team. There is currently no easy way to replace them.

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: Drawing or Changing scroll bar color on SynEdit
« Reply #2 on: May 15, 2019, 03:41:41 pm »
They are drawn by the OS, according to the OS team. There is currently no easy way to replace them.

rats... Thanks
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

M.A.R.C.

  • Jr. Member
  • **
  • Posts: 68
Re: [DONE] Drawing or Changing scroll bar color on SynEdit
« Reply #3 on: May 20, 2019, 05:54:52 am »
I have the same problem :(
Maybe is possible to set Scrollbars to ssNone and put some kind of self-painted scrollbars...

M.A.R.C.

  • Jr. Member
  • **
  • Posts: 68
Re: [DONE] Drawing or Changing scroll bar color on SynEdit
« Reply #4 on: May 20, 2019, 06:59:08 am »
Ok, I was able to make a proof of concept.

Code: Pascal  [Select][+][-]
  1. unit MainFormU;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, SynEdit,
  9.   GR32_RangeBars;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     HBar: TGaugeBar;
  17.     VBar: TGaugeBar;
  18.     SynEdit1: TSynEdit;
  19.     procedure HBarChange(Sender: TObject);
  20.     procedure SynEdit1Paint(Sender: TObject; ACanvas: TCanvas);
  21.     procedure VBarChange(Sender: TObject);
  22.   private
  23.  
  24.   public
  25.  
  26.   end;
  27.  
  28. var
  29.   Form1: TForm1;
  30.  
  31. implementation
  32.  
  33. { TForm1 }
  34.  
  35. procedure TForm1.HBarChange(Sender: TObject);
  36. begin
  37.   SynEdit1.LeftChar:=HBar.Position+1;
  38. end;
  39.  
  40. procedure TForm1.SynEdit1Paint(Sender: TObject; ACanvas: TCanvas);
  41. begin
  42.   VBar.Max:=SynEdit1.Lines.Count-SynEdit1.LinesInWindow;
  43.   VBar.Position:=SynEdit1.TopLine-1;
  44.   HBar.Max:=SynEdit1.CharsInWindow-SynEdit1.LeftChar;
  45.   HBar.Position:=SynEdit1.LeftChar-1;
  46. end;
  47.  
  48. procedure TForm1.VBarChange(Sender: TObject);
  49. begin
  50.   SynEdit1.TopLine:=VBar.Position+1;
  51. end;
  52.  
  53. initialization
  54.   {$I mainformu.lrs}
  55.  
  56. end.
  57.  

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: [DONE] Drawing or Changing scroll bar color on SynEdit
« Reply #5 on: May 20, 2019, 11:58:33 am »
Interesting... but I don't see where the color gray is drawn in your code.

Can you elaborate?
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

M.A.R.C.

  • Jr. Member
  • **
  • Posts: 68
Re: [DONE] Drawing or Changing scroll bar color on SynEdit
« Reply #6 on: May 20, 2019, 04:23:25 pm »
Interesting... but I don't see where the color gray is drawn in your code.

Can you elaborate?

I'm using the Graphics32 library and the TGaugebar component to customizing the scrollbar.

regards
« Last Edit: May 20, 2019, 04:24:58 pm by M.A.R.C. »

AlexTP

  • Hero Member
  • *****
  • Posts: 2365
    • UVviewsoft
Re: Drawing or Changing scroll bar color on SynEdit
« Reply #7 on: May 22, 2019, 11:49:26 pm »
Also can use ATFlatControls with ATScrollbar, you can change color of such bars via ATFlatTheme global record.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki

 

TinyPortal © 2005-2018