How to change color of buttons?

Posted on 2001-08-14
Last Modified: 2007-11-27
Is there an easy way of changing color of buttons? That
is buttons, bitbutton or speed buttons.
I'm using Delphi 5
Question by:czechmate
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 6386452
Good question.  I know it can be done in VB...  But then,  you didn't ask that ;)
LVL 34

Accepted Solution

Slick812 earned 100 total points
ID: 6386941
hello czechmate, TSpeedButton does not have a "Color" property, nor does TBitBtn. You want an easy way, well here's an easy way with a speedbutton place on your form a TShape, the size of the button and have it be a rectangle with a Yellow color. Then place a SpeedButton in the same location as the TShape (on Top of it) and make it the same size as the TShape. Then set the Speedbutton property of "Flat" to True, and set "Transparent" to True. This will give you a flat style button with color. To color a non-Flat button needs some coding to get the Paint event of the speed button.
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6387077

 there are some buttons with color property, you can download them with the source code from

Best regards
Mohammed Nasman
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 6387330
The way I have done this in the past is to put a TSpeedButton on a panel that is sized to the same size as the button. Set the Color property of the Panel to what you need and set the Transparent property of the TSpeedButton to True. Not elegant, but effective.

LVL 11

Expert Comment

ID: 6387512
TButton is an encapsulation of normal Windows buttons.
The button painting is handled by Windows.
The color is determined by the systemwide color settings.

As already mentioned you should download freeware button components from the usual locations.

Author Comment

ID: 6389132
Thanks guys, and the points go to Slick812 who was the first to come up with the TShape solution. Does justice to your nickname:))
LVL 34

Expert Comment

ID: 6389190
you can also use a rectangle bitmap shape Glyph in a Bit Button, but you have to draw the Text for a caption on the Bitmap

Author Comment

ID: 6389880
Yeah, that part I know and that's ok if you have a couple
of buttons. I am writing small calculator for fun and it
would be no fun to create 15 glyphs. What's more I battle
to draw straight lines not to mention pictures:)

I've stuffed around with shapes and it does not
look bad at all.

Thanks again and regards

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor ( Top Charts is a view in which you can set seve…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question