Ok I'm converting a program from Java to C# and currently stuck on a certain aspect of it.

Ok I have;

private Graphics g1;
private Bitmap picture;
picture = new Bitmap(x1, y1);
g1 = Graphics.FromImage(picture);
pbMand.Image = picture;

pbMand is the name of my picture box, which I will use to display the image (not drawing directly to form, using PB).

Then further on I have...

g1.setColor(Color.FromArgb(Convert.ToInt16(h), Convert.ToInt16(0.8f), Convert.ToInt16(b)));
                        //djm test
                        Color col = Color.getHSBColor(h, 0.8f, b);

I can't find an equivilent form javas setColor to something in C#...It seems to lack anything colour related in g1's methods.

And the error it gives is...
Error 1 'System.Drawing.Graphics' does not contain a definition for 'setColor' and no extension method 'setColor' accepting a first argument of type 'System.Drawing.Graphics' could be found (are you missing a using directive or an assembly reference?

Any help to solve this issue would be appreciated. I'm not sure what other information I can give either, so feel free to ask questions :)

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

7 Years
Discussion Span
Last Post by ronson

The BitMap class has a SetPixel method.
Call it like this SetPixel(x,y,aColor);
x,y : coordinates in int.
aColor : Color

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.