private void SolveBtn_Click(object sender, EventArgs e) { checkBox1.Checked = false; t.Enabled = false; Bitmap screenShot = null; screenShot = CaptureImage(Convert.ToInt32(XBox.Text), Convert.ToInt32(YBox.Text), Convert.ToInt32(WidthBox.Text), Convert.ToInt32(HeightBox.Text), Convert.ToInt32(ScaleBox.Text)); //pictureBox1.Image = screenShot; MineSolver solver = new MineSolver(); solver.Solve(solver.CheckImage(screenShot), Convert.ToInt32(XBox.Text), Convert.ToInt32(YBox.Text)); }
private void OverlayBtn_Click(object sender, EventArgs e) { Bitmap screenShot = CaptureImage(Convert.ToInt32(XBox.Text), Convert.ToInt32(YBox.Text), Convert.ToInt32(WidthBox.Text), Convert.ToInt32(HeightBox.Text), Convert.ToInt32(ScaleBox.Text)); MineSolver solver = new MineSolver(); var Field = solver.CheckImage(screenShot); screenShot = CaptureImage(Convert.ToInt32(XBox.Text), Convert.ToInt32(YBox.Text), Convert.ToInt32(WidthBox.Text), Convert.ToInt32(HeightBox.Text), 1); Rectangle[] rectangles = new Rectangle[481]; for (int y = 0; y < 16; y++) { for (int x = 0; x < 30; x++) { Graphics g; g = Graphics.FromImage(screenShot); Pen pen = new Pen(Brushes.Black); pen.Width = 5; Font font = new Font("Times New Roman", 12.0f); switch (Field[x, y]) { case 0: pen.Color = Color.FromArgb(80, 255, 255, 255); break; //Unknown: White case 1: pen.Color = Color.FromArgb(80, 112, 25, 33); break; //Flagged: Dark Red case 2: pen.Color = Color.FromArgb(80, 128, 128, 128); break; //0: Gray case 3: pen.Color = Color.FromArgb(80, 0, 0, 255); break; //1: Blue case 4: pen.Color = Color.FromArgb(80, 0, 255, 0); break; //2: Green case 5: pen.Color = Color.FromArgb(80, 255, 0, 0); break; //3: Red case 6: pen.Color = Color.FromArgb(80, 13, 13, 112); break; //4: Darkblue case 7: pen.Color = Color.FromArgb(80, 112, 50, 50); break; //5: Random default: pen.Color = Color.FromArgb(80, 0, 0, 0); break; } g.FillRectangle(pen.Brush, 44 * x, 44 * y, 43, 43); pen.Color = Color.Black; g.DrawString(Field[x, y].ToString(), font, pen.Brush, 44 * x, 44 * y); pen.Dispose(); //pictureBox1.Image = screenShot; } } pictureBox1.Image = screenShot; }
private void SaveImageBtn_Click(object sender, EventArgs e) { Bitmap screenShot = null; checkBox1.Checked = false; t.Enabled = false; screenShot = CaptureImage(Convert.ToInt32(XBox.Text), Convert.ToInt32(YBox.Text), Convert.ToInt32(WidthBox.Text), Convert.ToInt32(HeightBox.Text), Convert.ToInt32(ScaleBox.Text)); pictureBox1.Image = screenShot; MineSolver solver = new MineSolver(); solver.CheckImage(screenShot); SaveFileDialog saveFileDialog = new SaveFileDialog { Filter = "Bitmap (*.bmp)|.bmp" }; if (saveFileDialog.ShowDialog() == DialogResult.OK) { screenShot.Save(saveFileDialog.FileName); } }
private void TestBtn_Click(object sender, EventArgs e) { MineSolver ms = new MineSolver(); ms.RightClickField(1, 1, 0, Convert.ToInt32(XBox.Text), Convert.ToInt32(YBox.Text)); }