jeudi 23 avril 2015

What could be wrong with my if else statement?

 Card img = new Card();
   Deck im = new Deck();

    private void button1_Click(object sender, EventArgs e)
    {
        Bitmap bc;// = new Bitmap(100, 142);

        Brush b = new SolidBrush(Color.Green);
        Card[] card = im.Shuffling();

        bc = img.DrawCard(card[1]);

eventhough the Color1 property is == to b the the compiler still skips to the else statment, even if i use the not(!=) function all components still go in the if statment. Where could i be going wrong?

        if (card[1].Color1== b)
        {

            pic = new PictureBox();
            piclist = new List<PictureBox>();


            numberOfCards++;

            piclist.Add(pic);

            this.Controls.Add(pic);
            pic.Size = pictureBox1.Size;
            pic.Left = pictureBox1.Left + ((pictureBox1.Width) * numberOfCards);
            pic.Top = pictureBox1.Top;
            pic.Visible = true;
            pic.SizeMode = PictureBoxSizeMode.StretchImage;

            pic.BringToFront();

            pic.Image = bc;



        }
        else 
            MessageBox.Show("unequall");




    }

Aucun commentaire:

Enregistrer un commentaire