Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
LCL
»
Change ScrollBar color
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Weird error
by
xiyi0616
[
Today
at 07:10:18 am]
Fractal of Mandelbrot
by
threedslider
[
Today
at 05:59:26 am]
Trying to plot points, bu...
by
garymq
[
Today
at 05:53:24 am]
I hope FreePascal can sup...
by
xiyi0616
[
Today
at 03:57:43 am]
How to merge multiple cla...
by
cdbc
[
Today
at 02:16:37 am]
Remote desktop software i...
by
Boleeman
[
Today
at 12:59:14 am]
AI assisted translation o...
by
schuler
[April 13, 2026, 10:41:29 pm]
FPC Unleashed (inline var...
by
Fibonacci
[April 13, 2026, 09:21:04 pm]
fp-h2pas: New C header tr...
by
Gustavo 'Gus' Carreno
[April 13, 2026, 06:32:22 pm]
Nezplug Library Player
by
Gigatron
[April 13, 2026, 04:15:33 pm]
Eschecs (UCI chess GUI) 5...
by
Roland57
[April 13, 2026, 04:10:12 pm]
[ANN] fpGUI Toolkit v2.0....
by
cdbc
[April 13, 2026, 03:14:21 pm]
Lazarus Bugfix Release 4....
by
dbannon
[April 13, 2026, 01:52:18 pm]
Strange happenings with T...
by
jamie
[April 13, 2026, 12:41:42 pm]
Little bit...
by
jamie
[April 13, 2026, 12:17:43 pm]
Necromancer's Dos Navigat...
by
dbannon
[April 13, 2026, 11:03:26 am]
Can't pass string to TEdi...
by
cdbc
[April 13, 2026, 10:13:44 am]
Fixed Bzip2 unpacker from...
by
domasz
[April 13, 2026, 08:09:54 am]
Ann: DeCoperators
by
Thaddy
[April 13, 2026, 07:37:29 am]
Bad Sandwich
by
Guva
[April 12, 2026, 09:55:25 pm]
ZeosDB and sqlite3
by
dseligo
[April 12, 2026, 09:06:22 pm]
The ever re-appearing /= ...
by
Thaddy
[April 12, 2026, 08:07:09 pm]
Some Lazarus Graphics Rel...
by
Boleeman
[April 12, 2026, 03:45:30 pm]
Some Lazarus Utils N Stuf...
by
Boleeman
[April 12, 2026, 03:39:45 pm]
Ann: Deinline: a de-inlin...
by
Fred vS
[April 12, 2026, 03:17:40 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Change ScrollBar color (Read 4233 times)
Edson
Hero Member
Posts: 1328
Change ScrollBar color
«
on:
October 25, 2017, 10:57:57 pm »
I need to change the Scrollbars color of a ListBox, a TreeView, and a SynEdit component.
Is there some property or event to do this, or what other alternatives exist?
Logged
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10
jamie
Hero Member
Posts: 7660
Re: Change ScrollBar color
«
Reply #1 on:
October 26, 2017, 03:01:46 am »
Not easy..
a scrollbar most of the time is part of the main control. for example the listbox has a scrollbar but it
is automatically create when you create the listbox.
Windows sets all the needed items for the scrollbar control when it creates the listbox for you.
You can get at the scrollbar. You need to EnumChildWindows looking for the "SCROLLBAR" control class.
when you find it, it'll give you a handle to the control.
With this handle you can alter the colors using API functions but I am not sure how retained they will be
SetBkColor should do it..
You need to experiment a little..
Look on the net for getting the handle to a scrollbar control in a listbox and the other controls will work the
same way.
P.S.
I also use this method to get the Listbox handle of a Combobox to make sure it works back to Win2k..
Starting some where around vista MS gave a message to obtain it, but nothing earlier.
Happy hunting
Logged
The only true wisdom is knowing you know nothing
RAW
Hero Member
Posts: 871
Re: Change ScrollBar color
«
Reply #2 on:
October 26, 2017, 03:08:21 am »
I guess the easiest crossplatform way would be to create your own scrollbar and disable the scrollbars of the other controls, but I have no experience with this...
Logged
jamie
Hero Member
Posts: 7660
Re: Change ScrollBar color
«
Reply #3 on:
October 26, 2017, 04:25:47 am »
Memory is now coming back, scrollbar handles on some Windows controls are not accessible which
is when its a good time to make your own control and use a stand alone scrollbar control.
Logged
The only true wisdom is knowing you know nothing
PatBayford
Full Member
Posts: 125
Re: Change ScrollBar color
«
Reply #4 on:
October 26, 2017, 06:53:29 am »
I strongly suspect that scroll bars are very low level, and hence managed by the OS APIs. I'm not at all sure that any changes made will survive a re-draw! I am, as usual, prepared to be proven wrong!!
Logged
Lazarus 1.8.0 FPC 3.0.2 SVN 56594 Windows 10 64bit (i386-win32-win32/win64)
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
LCL
»
Change ScrollBar color
TinyPortal
© 2005-2018