Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to change color of buttons?

Posted on 2001-08-14
8
Medium Priority
?
3,421 Views
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
cj
0
Comment
Question by:czechmate
8 Comments
 
LVL 6

Expert Comment

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

Accepted Solution

by:
Slick812 earned 400 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.
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6387077
Hello

 there are some buttons with color property, you can download them with the source code from
 http://www.torry.net/buttons.htm

Best regards
Mohammed Nasman
0
Technology Partners: 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!

 
LVL 4

Expert Comment

by:jsweby
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.

J.
0
 
LVL 11

Expert Comment

by:robert_marquardt
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.
0
 
LVL 1

Author Comment

by:czechmate
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:))
Thanks
cj
0
 
LVL 34

Expert Comment

by:Slick812
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
0
 
LVL 1

Author Comment

by:czechmate
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
cj
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

971 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