Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            chart1.Series[0].Points.Clear();
            chart1.Series[1].Points.Clear();
            con = new ContainerForMinMaxValue();
            Square sq1 = new Square(new Point(Convert.ToInt16(textBox1.Text.Split(',')[0]),
                                              Convert.ToInt16(textBox1.Text.Split(',')[1])),
                                    new Point(Convert.ToInt16(textBox2.Text.Split(',')[0]),
                                              Convert.ToInt16(textBox2.Text.Split(',')[1])),
                                    new Point(Convert.ToInt16(textBox3.Text.Split(',')[0]),
                                              Convert.ToInt16(textBox3.Text.Split(',')[1])),
                                    new Point(Convert.ToInt16(textBox4.Text.Split(',')[0]),
                                              Convert.ToInt16(textBox4.Text.Split(',')[1])));

            PaintSquare(sq1, 0);
            Square sq2 = new Square(new Point(Convert.ToInt16(textBox5.Text.Split(',')[0]),
                                              Convert.ToInt16(textBox5.Text.Split(',')[1])),
                                    new Point(Convert.ToInt16(textBox6.Text.Split(',')[0]),
                                              Convert.ToInt16(textBox6.Text.Split(',')[1])),
                                    new Point(Convert.ToInt16(textBox7.Text.Split(',')[0]),
                                              Convert.ToInt16(textBox7.Text.Split(',')[1])),
                                    new Point(Convert.ToInt16(textBox8.Text.Split(',')[0]),
                                              Convert.ToInt16(textBox8.Text.Split(',')[1])));

            PaintSquare(sq2, 1);

            sq1.MinMax();
            con.Add(sq1);
            sq2.MinMax();
            con.Add(sq2);
            Console.WriteLine();
            double perCent;

            MessageBox.Show("Shadow Square area", FindShadowSquare(out perCent).ToString());
            MessageBox.Show("Light %", perCent.ToString());
            Dispose(sq1);
            Dispose(sq2);
            Dispose(con);
        }
Beispiel #2
0
 private void Dispose(ContainerForMinMaxValue con)
 {
     GC.SuppressFinalize(con);
 }