I'm working on my first Chess Game. I create a list of PictureBox, and create a class for each piece like this:
public class Fou : PictureBox
{
private ImageLayout ImageLayout;
public Fou()
{
Image = Properties.Resources.pionnoir;
this.ImageLayout = ImageLayout.Stretch;
SizeMode = PictureBoxSizeMode.StretchImage;
}
So now I have a picture in my PictureBox, but when I click on it I can't get the type of piece inside the PictureBox.
I would like to get the type, and use something like:
{
Fou pieceFou = new Fou();
PictureBox pb = (PictureBox)sender;
if (pb == pieceFou) { pb.BackColor = Color.AntiqueWhite; }
But it doesn't work.