Link to home
Start Free TrialLog in
Avatar of ISGDude
ISGDude

asked on

bitmap with same color controls

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

Avatar of shaneholmes
shaneholmes

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
Also, yes, you can assign colors thats are not (constants) in the property drop dpwn list.


Shane
Avatar of ISGDude

ASKER

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?
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
Remember, for example for checkbox You should set not only Color but also Font.Color
Avatar of kretzschmar
? 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 ;-)
Avatar of ISGDude

ASKER

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.  
ASKER CERTIFIED SOLUTION
Avatar of shaneholmes
shaneholmes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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