hi :)
i am new in C#, i am trying to make a little chess program and i need help in the chess board making.
i make a new class "Square" that inherit from PictureBox (Square:PictureBox)
and i made an array of 8x8 of Square in the Form1.cs and i use for loops to add them the parameters i need and add them to the form but it doesnt work...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ChessOpeningRepertoire
{
public partial class Form1 : Form
{
private Square[,] square;
public Form1()
{
InitializeComponent();
int i, j;
this.square = new Square[8, 8];
for (i = 0; i < 8; i++)
{
for (j = 0; j < 8; j++)
{
this.square[i,j].BackColor = System.Drawing.SystemColors.ActiveCaption;
this.square[i,j].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.square[i,j].Location = new System.Drawing.Point(57+i*40, 109+j*40);
this.square[i,j].Name = "pictureBox1";
this.square[i,j].Size = new System.Drawing.Size(40, 40);
this.square[i,j].TabIndex = 2;
this.square[i,j].TabStop = false;
this.Controls.Add(this.square[i,j]);
}
}
}
}
}
and the class Square -
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ChessOpeningRepertoire
{
class Square:PictureBox
{
private bool color;
private char piece;
}
}
the problem its say i have a problem in the part when i use the PictureBox definition parameters for the Square (for example: "this.square[i,j].BackColor = System.Drawing.SystemColors.ActiveCaption;")
what am i doing wrong??
thanks in advance
Gal :)