I think you mean you want to control the relative intensity of "green" with some kind of run-time adjustable control, like a TrackBar.
In any case, imho, you shoud always keep a "virgin" copy of the original full-color file around, whether you use any of the types of solutions suggested here !
If you are going to do this in code, then you are almost certainly going to want to examine the "relatively newer" ColorMatrix facility[
^], and the ImageAttributes Class[
^].
Or you may want to use what are now older techniques involving the Paint operation and LockBits: literally looping through every pixel and modifying its alpha value.
There are articles on CP showing how to accomplish this, and I strongly suggest you search CP for them. Such as:[
^] ... and ... "Making Transparent Controls with C# and .NET 3.5"[
^].
A "quick and dirty" solution would be to create two bit-maps: start with the original image: open it in GIMP or PhotoShop, then ... for example in PhotoShop ... use the Image/Adjustments/Saturation dialog, check the "colorize" button, and then make the image very dark greenish.
Obviously, in your project: you'll want to put the "greened image" on top of the original full-color, and then alter its opacity value with a TrackBar, or whatever, to control how "green" it is.
But, the tricky question is: in what Container should the second (greened) image be ! Or, the first full-color image ?
Since a PictureBox does not support opacity directly: see this discussion for how to achieve that: "C# Opacity Of Picturebox"[
^].
For using Panels to achieve transparency, see this: see Bob Powell's old, but good, article: [
^]
For using transparency/opacity with UserControls: the same CP resources linked to above will give you some guidelines. Also see this MSDN discussion:[
^].
Finally, while I am generally against the idea of putting Forms inside ... or "over" other Forms in general; you could put the "greened" picture in its own borderless Form (as BackGroundImage): then: in the Main Form (with the TrackBar):
1. create a new instance of the second Form.
2. set the 'Owner Property of the second Form to the Main Form ... "independent" opacity will NOT work for the second Form if you add it to the ControlCollection of the Main Form !
3. Do the right thing in Main Form load event to position the second greened form exactly over the first colored Form. Your Main Form Load event might then look like this:
private Form2 f2;
Form1_Load(object sender, EventArgs e)
{
f2 = new Form2();
f2.Owner = this;
f2.Show();
f2.Location = PointToScreen(ColorPictureBox.Location);
f2.BringToFront();
}
Then you can use the Main FormTrackBar change Value to set the opacity of the greened form:
private void trackBar1_Scroll(object sender, EventArgs e)
{
f2.Opacity = Convert.ToDouble(trackBar1.Value) / 100.0;
}
This will work ... but ...
The question you might want to really evaluate carefully here is:
do you want build a one-off solution for making a picture "greened," asap: or,
do you want to master a set of techniques that could be generally useful in the future for doing all kinds of bitmap manipulation ?
good luck, best, Bill