Frage

I am making an application with the background black, and of course, the components tscrollbar than It shows(grids, panels, etc ... )leave me the default color of the system. Is there any way to change them? Maybe picking up some system message... I am using XE2, With VCL. Thank you.

War es hilfreich?

Lösung

There is not such thing like change the color of the scrollbars directly. You only option is draw the scrollbars your self. To do this you must draw each element of the scrollbar (thumb, slider and arrows) handling the WM_NCPAINT message, also you must track the user interaction with the scrollbar to properly update the scrollbar this is done handling the WM_NCHITTEST, WM_NCCALCSIZE, WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_VSCROLL, WM_HSCROLL and others. So you best option to avoid all this work is use the VCL Styles introduced in Delphi XE2, on this way you can modify a VCL Style file to draw the scrollbars as you want. Now if you want transit for the hard way you can try the TSysScrollingStyleHook class which is part of the VCL Style Utils project and can show you how draw a scrollbar.

Andere Tipps

You will need to create a custom component that responds to the Windows WM_NCPAINT which is the non-client area paint message.

There is some C source-code available here that covers custom drawing of scrollbars that you might find useful.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top