Exemple #1
0
 //display method
 public void Display(CircularShape ci)
 {
     richTextBox1.AppendText(ci.GetType().Name + ":\n" +
                             "Radius: " + ci.Radius + "\n" +
                             "Height: " + ci.Height + "\n" +
                             "Side: " + ci.Side + "\n" +
                             "Perimeter: " + ci.Perimeter().ToString("f2") + "\n" +
                             "Area: " + ci.Area().ToString("f2") + "\n" +
                             "Volume: " + ci.Volume().ToString("f2") + "\n\n");
 }
Exemple #2
0
        //----------------------------------------------------------
        private void Display(CircularShape cs)
        {
            string[]     items = { cs.GetType().Name,
                                   cs.R.ToString("f3"),
                                   cs.H.ToString("f3"),
                                   cs.Perimeter().ToString("f3"),
                                   cs.Area().ToString("f3"),
                                   cs.Volume().ToString("f3") };
            ListViewItem lvi = new ListViewItem(items);

            // add the row to the listview
            listView1.Items.Add(lvi);
            // making the last item visible
            listView1.EnsureVisible(listView1.Items.Count - 1);
        }
Exemple #3
0
        private void Display(CircularShape c)
        {
            string name = c.GetType().Name;
            double peri = c.Perimeter();
            double area = c.Area();
            double vol  = c.Volume();

            richTextBox1.AppendText(
                "name: " + name +
                "  r:" + c.Radius +
                "  peri:" + peri.ToString("n") +
                "  area:" + area.ToString("n") +
                "  vol:" + vol.ToString("n") + "\n");
            //scroll down
            richTextBox1.ScrollToCaret();
        }