Solved

bitmap with same color controls

Posted on 2004-04-08
10
471 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
In this Micro Tutorial viewers will learn the basic shortcuts and functions of Illustrator. The viewer will learn about the paintbrush tool, anchor points, font sizing, and more.
Not only does Prezi allow you to create non-linear presentations, it also makes it easy to apply transition animations between your frames. Learn how to apply a fade-in transition to select items and entire frames in this tutorial Select "Edit Path"…

920 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

16 Experts available now in Live!

Get 1:1 Help Now