Ejemplo n.º 1
0
        private void rndTr_Click(object sender, RoutedEventArgs e)
        {
            shiftx.Value = 0;
            shifty.Value = 0;
            canvas.Children.Clear();
            rec = null;

            tri = DrawClass.RandomTriangle();

            DrawTriangle(tri);

            info.Content = "point1(" + Math.Round(tri.GetPoint1().GetX()).ToString() + ";" + Math.Round(tri.GetPoint1().GetY()).ToString() + ")\n" +
                           "point2(" + Math.Round(tri.GetPoint2().GetX()).ToString() + ";" + Math.Round(tri.GetPoint2().GetY()).ToString() + ")\n" +
                           "point3(" + Math.Round(tri.GetPoint3().GetX()).ToString() + ";" + Math.Round(tri.GetPoint3().GetY()).ToString() + ")\n" +
                           "Perimeter: " + Math.Round(tri.GetPerimeter()).ToString() + "\n" +
                           "Area: " + Math.Round(tri.GetArea()).ToString();
        }
Ejemplo n.º 2
0
        private void square_Click(object sender, RoutedEventArgs e)
        {
            shiftx.Value = 0;
            shifty.Value = 0;
            canvas.Children.Clear();
            tri = null;

            rec = DrawClass.Square();

            DrawRectangle(rec);

            info.Content = "point1(" + Math.Round(rec.GetPoint1().GetX()).ToString() + ";" + Math.Round(rec.GetPoint1().GetY()).ToString() + ")\n" +
                           "point2(" + Math.Round(rec.GetPoint2().GetX()).ToString() + ";" + Math.Round(rec.GetPoint2().GetY()).ToString() + ")\n" +
                           "point3(" + Math.Round(rec.GetPoint3().GetX()).ToString() + ";" + Math.Round(rec.GetPoint3().GetY()).ToString() + ")\n" +
                           "point4(" + Math.Round(rec.GetPoint4().GetX()).ToString() + ";" + Math.Round(rec.GetPoint4().GetY()).ToString() + ")\n" +
                           "Perimeter: " + Math.Round(rec.GetPerimeter()).ToString() + "\n" +
                           "Area: " + Math.Round(rec.GetArea()).ToString();
        }