示例#1
0
 public MainForm()
 {
     InitializeComponent();
     grid = new Grid(100, 100);
     grid.Randomize();
     backgroundWorker.WorkerSupportsCancellation = true;
     comboBox_size.SelectedItem = "100";
     DrawArea = new Bitmap(drawBox.Size.Width, drawBox.Size.Height);
 }
示例#2
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (!backgroundWorker.IsBusy)
     {
         this.Invoke((Action)(() =>
         {
             grid = new Grid(Int32.Parse(comboBox_size.SelectedItem.ToString()), Int32.Parse(comboBox_size.SelectedItem.ToString()));
             grid.Randomize();
             DrawGrid();
         }));
     }
 }