Solved

How to change color of buttons?

Posted on 2001-08-14
8
3,298 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 33

Accepted Solution

by:
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.
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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 33

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to use Hashing sha1 in Delphi 2010 4 261
Delphi - replicating a form 8 73
Can Viruses spread while transferring Binary data with Winsock 2 73
Delphi inherited method 6 68
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

786 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