Reputation: 33
I am very new to C# and couldn't find any information on the color type online. Sorry if this is a poorly worded question.
I am trying to make an if statement that checks if the RGB value of a part in a color array is a certain color but I'm not exactly sure how to go about it. Basically what I want to do is this:
if(color[100, 100] = RGB Color 255, 0, 0)
{
//Do something
}
Upvotes: 0
Views: 2449
Reputation: 4401
That code in c# would be:
if (color[100, 100] == Color.FromARGB(255, 0, 0))
{
//do something...
}
The Color.FromARGB()
method also has an overload where the first parameter accepts an alpha opacity level from 0-255, but you probably won't need that.
The code above assumes that your color[,]
array actually contains an array of colors, of course.
Upvotes: 9