0

hi i am trying to learn programing by myself as i am not old enough to take the subject at school i have tryed to use tutorials but i am stuck in my attempt to make a game of life.
i have seen some examples but am getting confused at the code.
i have drawn a grid but i do not no how to make each individual square become dead or alive if anybody could help me or show me a good tutorial i would be thankfull

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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            
        }

        private Graphics g;
        private System.Drawing.Bitmap bitmap;
        private static int br;
        private static int bc;
        private static int c;
        private static int r;
        

        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
       
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
    
        }

        private void button2_Click(object sender, EventArgs e)
        {
                
        }

        private void button3_Click(object sender, EventArgs e)
        {
            br = Convert.ToInt32(row1.Text);
            br = int.Parse(row1.Text);
            bc = Convert.ToInt32(col1.Text);
            bc = int.Parse(col1.Text);
            c = 20;
            r = 20;

            bitmap = new Bitmap(r, c);
            g = Graphics.FromImage(bitmap);
            pictureBox1.Image = new Bitmap(500, 500);
            g = Graphics.FromImage(this.pictureBox1.Image);
            Pen mypen = new Pen(Color.Black, 2);
            for (int i = 0; i < bc; i++)
            {
                g.DrawLine(mypen, i * bc, 0, i * bc, br * bc);
                g.DrawLine(mypen, 0, i * bc, br * bc, i * bc);
            }
            mypen.Dispose(); 
        }
    }
}
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by __avd
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.