Fog Creek Software
Discussion Board




Colorfull buttons..

What can you say about it? I'm using Delphi4.

Neturiu vardo
Wednesday, October 23, 2002

You mean you want buttons with colors other than clBtnFace? Well, you wouldn't be asking if you hadn't already discovered there's no 'Color' property on TButton, so here's an alternative:

Use a TPanel (which you can 'Color'), then program its OnMouseDown/OnMouseUp events to wiggle the panel's BevelInner/BevelOuter properties in such a way as to mimic a 3D button being depressed and released.

Works for me.

Kristofer

Kristofer Skaug
Thursday, October 24, 2002

Delphi's TButton is a wrapper around the standard Windows button control, which doesn't support custom colors. TBitBtn is an owner-drawn button, but it doesn't support color either since it uses the DrawFrameControl function.

There are quite a few freeware components out there that already handle this for you. Try some of the components at http://www.torry.net/buttons.htm - there's a bunch of button controls that support custom colors.

Yorai Aminov
Thursday, October 24, 2002

*  Recent Topics

*  Fog Creek Home