Users Pricing

forum

Home Forums C# check button image – MindStick

C# check button image

Anonymous User 3252 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?


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md