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
Solved

bitmap with same color controls

Posted on 2004-04-08
10
473 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
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
 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
error 1.1 400 Bad request idhttp delphi 18 147
Adoquery sql  left join does not work 25 99
Delphi...Split view - idea? 1 89
enhance the following code 3 37
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this second Micro Tutorial in the series,  viewers will learn more basic shortcuts and functions of Illustrator. In this tutorial you will learn about the eyedropper tool, zoom , ellipses and more.
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…

860 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