Sometimes there could be problems in comparing two colors in C Sharp because we cant direct compare two colors using (==) operator. One handy solution is that write a function that compares each component of the color as:
public bool comp(Color A, Color B)
{
if (A.A.Equals(B.A) && A.R.Equals(B.R) && A.G.Equals(B.G) && A.B.Equals(B.B))
{
return true;
}
else
{
return false;
}
}
No comments:
Post a Comment