Jimmy
Jimmy

Reputation: 569

Clear Graphics Object to Black or other RGB

I am a rank beginner in C#. I am currently using this code:

        objGraphics.Clear(SystemColors.Control);

What I want to do is Clear this object to black (or some other RGB color), and I'm stumped as to how to replace the SystemColors.Control with, preferably, an RGB color spec. I'd probably want to clear to black most of the time. Any help will be much appreciated!

Upvotes: 2

Views: 509

Answers (2)

lxalln
lxalln

Reputation: 930

objGraphics.Clear(Color.Black);

or

objGraphics.Clear(Color.FromArgb(r, g, b));

Upvotes: 2

Gerrie Schenck
Gerrie Schenck

Reputation: 22368

Color black = Color.FromName("Black");
objGraphics.Clear(black);

Upvotes: 0

Related Questions