Recent

Author Topic: TStatusbar color  (Read 863 times)

Espectr0

  • Full Member
  • ***
  • Posts: 218
TStatusbar color
« on: February 24, 2023, 12:57:45 pm »
Hola,

Is there a way to change the color of the TStatusbar without removing theme?

Thanks!!

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: TStatusbar color
« Reply #1 on: February 24, 2023, 02:45:57 pm »
Add Panels. For those panels that you want to draw yourself, set their Style to psOwnerDraw and write a handler for the OnDrawPanel event.

This draws the panels only, though. If you also want to draw the outer parts of the panels you should use a plain-old panel on which you can paint yourself without restrictions; add labels for the text.
« Last Edit: February 24, 2023, 02:48:26 pm by wp »

Espectr0

  • Full Member
  • ***
  • Posts: 218
Re: TStatusbar color
« Reply #2 on: February 24, 2023, 03:40:30 pm »
interesting thanks for the example, it's a shame you can't paint the whole bar...
but if I wanted to make a statusbar with a panel, is there any routine in which I can get the system sizegrip?

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: TStatusbar color
« Reply #3 on: February 24, 2023, 07:42:20 pm »
I found two possibilities, each with their pros and cons:

/1/ The font 'Marlett' has a gripper structure on the character position 'o' and 'p' (one for the light and one for the shadow part) --> simply paint this on the panel's canvas. Pro: Works with all widgetsets in which the Marlett font exists. Con: looks a bit old-fashioned...

/2/ The ThemeServices provide a themed element tsGripper, and you can invoke them to paint them. This works in all widgetsets which support this element (at least Win and gtk2 - did not test others). A problem is that we mix themed and custom painting here, and therefore this combination may not work with all color combinations. In Windows, for examples, the dotted gray gripper is hardly visible when the panel color is clSkyBlue.
« Last Edit: February 24, 2023, 07:47:30 pm by wp »

Espectr0

  • Full Member
  • ***
  • Posts: 218
Re: TStatusbar color
« Reply #4 on: February 24, 2023, 09:03:54 pm »
@wp thanks, always with solutions and very good examples!

I'm going to use the ThemeServices mode ;)

 

TinyPortal © 2005-2018