Recent

Author Topic: Change color on a TTrackBar component  (Read 4043 times)

mrdebug

  • Full Member
  • ***
  • Posts: 160
Change color on a TTrackBar component
« on: November 07, 2011, 10:17:28 pm »
Is there a way for change the color of a TTrackBar component? My client wants red color from the zero value to the arrow position in a TTrackBar component. Wants then the default color from the arrow position to the end value of the TTrackBar component.

Can I do this? How?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Change color on a TTrackBar component
« Reply #1 on: November 08, 2011, 10:08:25 am »
Use TCDTrackBar: wiki.lazarus.freepascal.org/Lazarus_Custom_Drawn_Controls (the wiki seams down)

Make sure you use the very latest Lazarus svn (like from the last comit I just did). The CD controls are located in the package in lazarus/components/customdrawn but I intend to move them to the LCL

Using this controls you can change the color pallete or change the entire drawing of the control.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Change color on a TTrackBar component
« Reply #2 on: November 08, 2011, 10:11:05 am »
In your case just the palette won't do it, you will need to create a new style which installs itself as dsExtra2 and override the method DrawTrackBar. You can copy the code from one of the other styles and modify it.

zeljko

  • Hero Member
  • *****
  • Posts: 1821
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Change color on a TTrackBar component
« Reply #3 on: November 12, 2011, 05:01:50 pm »
Felipe, I haven't tried CD controls yet ... is it useable with eg qt widgetset ?

 

TinyPortal © 2005-2018