c# - How to put green tick or red cross in winforms? -
is there way can put green tick or red cross besides label in windows forms? need show if configuration success or not. using c#.
thanks.
pretty easy do.
you can add both images, or labels i'm using in example, beside text label , toggle manually visible property.
in example, i'm using button click show tick/cross :
    private void button1_click(object sender, eventargs e)     {         lblcheck.visible = false;         lblcross.visible = false;          if (checkconfiguration())         {             lblcheck.visible = true;         }         else         {             lblcross.visible = true;         }     }   in designer, lblcheck label containing unicode character ✓ (\u2713) color set green, , lblcross label containing x color set red, @ same spot.
or, can go 1 label , change text & forecolor property dynamically, :
        lblverif.text = string.empty;          if (checkconfiguration())         {             lblverif.text = "✓";             lblverif.forecolor = color.green;         }         else         {             lblverif.text = "x";             lblverif.forecolor = color.red;         }   for both ways, looks :

Comments
Post a Comment