Try this one!! it works for me!
bool b = false;
for (int i = 0; i < 255; i++)
{
if (pictureBox_OK.Image.Palette.Entries[i] == Properties.Resources.OK.Palette.Entries[i])
{
b = true;
}
else
{
b = false;
break; // break the ( for (int i = 0; i < 255; i++))
}
}