public Formhcn(hcn k) { // groupBox1.Text = "Hinh chu nhat "+i.ToString(); InitializeComponent(); hcn = new hcn(k.d1, k.d2, k.mau); Point d1 = s.toado1(k.d1.X, k.d1.Y); textBox1.Text = d1.X.ToString(); textBox2.Text = d1.Y.ToString(); d1 = s.toado1(k.d3.X, k.d3.Y); textBox3.Text = d1.X.ToString(); textBox4.Text = d1.Y.ToString(); d1 = s.toado1(k.d4.X, k.d4.Y); textBox5.Text = d1.X.ToString(); textBox6.Text = d1.Y.ToString(); d1 = s.toado1(k.d2.X, k.d2.Y); textBox7.Text = d1.X.ToString(); textBox8.Text = d1.Y.ToString(); int dai, rong, t, tt; t = (int)(Math.Abs(k.d1.X - k.d2.X) / 5); tt = (int)(Math.Abs(k.d1.Y - k.d2.Y) / 5); if (t > tt) { dai = t; rong = tt; } else { dai = tt; rong = t; } textBox9.Text = dai.ToString(); textBox10.Text = rong.ToString(); textBox11.ForeColor = k.mau; }
private void button2_Click(object sender, EventArgs e) { int x1 = Convert.ToInt16(textBox1.Text); int y1 = Convert.ToInt16(textBox2.Text); int x2 = Convert.ToInt16(textBox7.Text); int y2 = Convert.ToInt16(textBox8.Text); if (radioButton1.Checked == true) { xoa = 1; } hcn = new hcn(s.toado2(x1, y1), s.toado2(x2, y2), textBox11.ForeColor); this.Close(); }
private void button2_Click(object sender, EventArgs e) { int x1 = Convert.ToInt16(textBox1.Text); int y1 = Convert.ToInt16(textBox2.Text); int x2 = Convert.ToInt16(textBox7.Text); int y2 = Convert.ToInt16(textBox8.Text); if (radioButton1.Checked == true) { xoa = 1; chon = 0; } if (chon != 0 && mauto == textBox11.ForeColor) { MessageBox.Show("Mau to da bi trung mau duong ve"); return; } hcn = new hcn(s.toado2(x1, y1), s.toado2(x2, y2), textBox11.ForeColor); this.Close(); }
public hcn getpro() { hcn item = new hcn(d1, d2, mau); return(item); }