hi guys please help me
i want to know how i can pass an i ,j argumaents to the function abc so that i can do oprations on i, j in function abc
Button[,] b = new Button[8, 8];
void drawchessboard()
{
int x=60, y=10,z=0;
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
b[i, j] = new Button();
b[i, j].Name = "b" + Convert.ToString(i) + Convert.ToString(j);
b[i, j].Text = " ";
b[i, j].Width = 80;
b[i, j].Height = 80;
b[i, j].FlatStyle = FlatStyle.Flat;
b[i, j].Location = new Point(x,y);
if (z == 0)
{ b[i, j].BackColor = Color.White;
z = 1; }
else
{ b[i, j].BackColor = Color.DarkGray;
z = 0; }
b[i, j].Click += new EventHandler(abc);
Button button = new Button();
this.Controls.Add(b[i,j]);
x = x + 81;
}
//MessageBox.Show(""+n);
y = y + 81;
x = 60;
if(z==1)
{ z = 0;}
else
{ z = 1; }
}
}
void drawpieces()
{
for (int j = 0; j < 8; j++)
{
b[1, j].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory+"/black_pawn.png");
b[6, j].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory+"/white_pawn.png");
}
b[0, 0].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/black_rook.png");
b[0, 7].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/black_rook.png");
b[0, 1].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/black_knight.png");
b[0, 6].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/black_knight.png");
b[0, 2].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/black_bishop.png");
b[0, 5].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/black_bishop.png");
b[0, 3].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/black_queen.png");
b[0, 4].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/black_king.png");
b[7, 0].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/white_rook.png");
b[7, 7].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/white_rook.png");
b[7, 1].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/white_knight.png");
b[7, 6].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/white_knight.png");
b[7, 2].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/white_bishop.png");
b[7, 5].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/white_bishop.png");
b[7, 3].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/white_queen.png");
b[7, 4].Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/white_king.png");
}
void abc(object sender, EventArgs e)
{
MessageBox.Show("gfd");
}
private void Form1_Load(object sender, EventArgs e)
{
drawchessboard();
drawpieces();
}