private void buttonInit_Click(object sender, EventArgs e) { bitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height); fast_bmp = new FastBitmap(bitmap); if (textBox1.Text.Contains(",")) { width = (int)Convert.ToDouble(textBox1.Text); } else { width = Convert.ToInt32(textBox1.Text); } if (textBox2.Text.Contains(",")) { height = (int)Convert.ToDouble(textBox2.Text); } else { height = Convert.ToInt32(textBox2.Text); } if (textBox3.Text.Contains(",")) { toolWidth = (int)Convert.ToDouble(textBox3.Text); } else { toolWidth = Convert.ToInt32(textBox3.Text); } if (textBox4.Text.Contains(",")) { toolHeight = (int)Convert.ToDouble(textBox4.Text); } else { toolHeight = Convert.ToInt32(textBox4.Text); } /*width = Convert.ToInt32(textBox1.Text); * height = Convert.ToInt32(textBox2.Text); * toolWidth = Convert.ToInt32(textBox3.Text); * toolHeight = Convert.ToInt32(textBox4.Text);*/ if (radioButton1.Checked == true) { tool = new Scoring(toolWidth, toolHeight); } else { tool = new Cutter(toolWidth, toolHeight); } workPiece = new WorkPiece(width, height); pictureBox1.Invalidate(); }
public MainForm() { InitializeComponent(); // way = new FirstWay(); bitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height); fast_bmp = new FastBitmap(bitmap); if (textBox1.Text.Contains(".")) { width = (int)Convert.ToDouble(textBox1.Text); } else { width = Convert.ToInt32(textBox1.Text); } if (textBox2.Text.Contains(".")) { height = (int)Convert.ToDouble(textBox2.Text); } else { height = Convert.ToInt32(textBox2.Text); } if (textBox3.Text.Contains(".")) { toolWidth = (int)Convert.ToDouble(textBox3.Text); } else { toolWidth = Convert.ToInt32(textBox3.Text); } if (textBox4.Text.Contains(".")) { toolHeight = (int)Convert.ToDouble(textBox4.Text); } else { toolHeight = Convert.ToInt32(textBox4.Text); } tool = new Scoring(toolWidth, toolHeight); workPiece = new WorkPiece(width, height); FTW = new myDelegate(Repaint); DoubleBuffered = true; }