Color Changing

  • Thread starter Thread starter theinvisibleGhost
  • Start date Start date
T

theinvisibleGhost

Hi,
I'm creating a user control that simulates an LED.
I've got a bitmap currently for the LED in 3 states
Red, Green, and Grey.
It would be really good if I could just take one of those
bitmaps and apply a colour mask (Or something(don't really know what
I'm talking about here!)
So that I could change the LED to be any colour.
The original green bitmap is made up of many shades
of green with a metal like ring surrounding it.
I created the Red bitmap with Photoshop.
Is there an easy way of doing this in C#?

What I'm aiming is to have a method on the user control
along the lines of
public void setColour(Color newColour)

:-)

Thanks
Chris
 
Hi,

Check the GDI+ functions like System.Drawing, there you can find bitmap
manipulation functions. What you can do is replace the colour (if it is
plain) or apply a filtered mask to the bitmap. If the colour is not plain you
have to create the mask on photoshop as well, therefore your application will
be smaller with three small bitmap than creating a mask.

Hope this helps,
Salva
 
I have written several controls that have an LED instrumentation look and
none of them used bitmaps.

All the segment drawing was done by GDI+ instructions. The drawing is
scalable and looks much better when the control is made larger or smaller
than the original size.

With an LED bitmap you can't change size and retain the quality so well.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Back
Top