forum

home / developersection / forums / c# check button image

C# check button image

Anonymous User 3122 04-Feb-2014

I need to check if the button have no image(BackColor changes to green) or an image called Atorre(BackColor changes to red), heres my code:

public static bool IsEnemyOrEmptyA(Button check)
{
    var Atorre = teste.Properties.Resources.Atorre;
    bool res;
    if (check == null || check.Image == null)
    {
        res = true;
        check.BackColor = Color.Green;
        return res;
    }
    else if (check.Image == teste.Properties.Resources.Atorre)
    {
        res = true;
        check.BackColor = Color.Red;
        return res;
    }
    else
    {
        res = false;
        return res;
    }
}

but even if its an other image, the button displays backcolor red or nothing. Any suggestions?


c# c# 
Updated on 04-Feb-2014

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By