9 Ağustos 2010 Pazartesi

Picturebox a 8X8 kareler oluşturma

 int width = 0;
        int height = 0;
        int count = 8;
        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            width = ((pictureBox1.Width) / count);
            height = ((pictureBox1.Height) / count);

            for (int i = 0; i < count; i++)
            {
                for (int j = 0; j < count; j++)
                {
                    Pen pen = new Pen(Color.Blue, 2);
                    Rectangle r = new Rectangle(i * width, j * height, width, height);
                    e.Graphics.DrawRectangle(pen, r);
                }
            }
        }

Hiç yorum yok:

Yorum Gönder