Solved

bitmap with same color controls

Posted on 2004-04-08
10
470 Views
Last Modified: 2013-12-03
I have a bitmap of a block diagram on a form which has a grey background.  Placed on top of the bitmap are check boxes, comboboxes, labels, and other controls.

The problem I'm having is when the program is loaded on other computers with different color settings.  The clBtnface color is a different shade of grey.  Which makes the form look really cheesey.

I have tried saving the bitmap with different color levels,  i.e. 16, 256, 24Bit.  The setting needs to be the same as the computer your using at the time to come close to matching the colors.

What is the common way to do somthing like this.  Use a GIF with transparent backgound?  Set a constant  and assign the color I need for each control?  If this is the answer then do I assign the color in the form.create procedure?  Will it accept a color thats not in the property list?

Hope this makes sense.

Randy

0
Comment
Question by:ISGDude
10 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10786277
clBtnFace is a system color, don't use clBtnFace, set it to the color you want - Example: clGray. This wil be the same color on all machines.

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10786287
Also, yes, you can assign colors thats are not (constants) in the property drop dpwn list.


Shane
0
 

Author Comment

by:ISGDude
ID: 10786377
The clGray is too dark for my needs and the other default colors don't work.  Should I find the hex value for LtGrey for 256 colors and set the form color property to this?
Is there an easy way to find the hex color setting?
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10786414
convert a hex color string to a TColor variable? Try this:
 
{
  sColor should be in XXXXXX format
  (X being a hex digit)
}
function
  HexToTColor( sColor : string )
    : TColor;
begin
  Result :=
    RGB(
      { get red value }
      StrToInt( '$'+Copy( sColor, 1, 2 ) ),
      { get green value }
      StrToInt( '$'+Copy( sColor, 3, 2 ) ),
      { get blue value }
      StrToInt( '$'+Copy( sColor, 5, 2 ) )
    );
end;


Shane
0
 
LVL 17

Expert Comment

by:mokule
ID: 10786504
Remember, for example for checkbox You should set not only Color but also Font.Color
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 11

Expert Comment

by:shaneholmes
ID: 10786526
Here is an entire list of HEX colors

http://hotwired.lycos.com/webmonkey/reference/color_codes/

Shane
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10786574
? why not paint your bitmap-background transparent ?

use the onpaint event for painting yourself for ex.
(there are also other methods)

no time for a sample yet,
but other experts may pickup this suggestion,
lately tomorrow myself, if this will solve your problem

meikl ;-)
0
 

Author Comment

by:ISGDude
ID: 10787722
Well, I downloaded a color pallet program and it told me my bitmap background color was 0xc0c0c0 which turns out to be clSilver.  I changed the form to this color and everything matches except the menu bar.  

I still need to see what it looks like on other PCs.  

I think converting to Gif89 and making the backgound transparent is the way to go.  
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 250 total points
ID: 10787777
Did you try making your bitmap background transparent?

R U using a TImage? - You can set the transparent background color

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10787790
If you decide to use GIF, check out this article on ABout.com

www.delphi.about.com

Working with GIF images in Delphi
ARTICLES :: Need to display an animated GIF image in a Delphi application? Even though Delphi does not natively support GIF image files formats (like BMP or JPEG) there are a few great (free source) components available on the Net, which add the ability to display and manipulate GIF images at run as well as at design time to any Delphi application.
Thursday April 08, 2004  #

http://www.delphi.about.com/library/weekly/aa040604a.htm

SHane

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Learn how to download your full Prezi presentation for offline presenting. Prezi doesn’t have to be viewed and shared in a web browser, even with a free account you can download your full presentation to share with others. Be sure to download any vi…
Learn how to use the remote presentation tool in Prezi to allow you to harness the power of this cloud based presentation platform. You can show your presentation with a remote audience using this free tool.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now