コード例 #1
0
        public void DrawPolyPies(int FromAngle, int ToAngle, int Originx, int Originy, Brush mybrush)
        {
            Polygon myPolygon = new Polygon();

            myPolygon.Stroke              = Brushes.Black;
            myPolygon.Fill                = mybrush;
            myPolygon.StrokeThickness     = 0.25;
            myPolygon.HorizontalAlignment = HorizontalAlignment.Left;
            myPolygon.VerticalAlignment   = VerticalAlignment.Center;
            PointCollection myPointCollection = new PointCollection();

            myPointCollection.Add(new Point(Originx, Originy));

            for (int i = FromAngle; i <= ToAngle; i = i + 1)
            {
                PolarPoint p1 = new PolarPoint(Originx, i);
                myPointCollection.Add(new Point(Originx + p1.X, Originy + p1.Y));
            }

            myPointCollection.Add(new Point(Originx, Originy));

            myPolygon.Points = myPointCollection;
            Canvas2.Children.Add(myPolygon);
            //  Canvas.Children.Add(myPolygon);
        }
コード例 #2
0
        public void DrawPolyLines(int FromAngle, int ToAngle, int Originx, int Originy, Brush Fill, Brush Stroke)
        {
            Polygon myPolygon = new Polygon();

            myPolygon.Stroke              = Stroke;
            myPolygon.Fill                = Fill;
            myPolygon.StrokeThickness     = 0.25;
            myPolygon.HorizontalAlignment = HorizontalAlignment.Left;
            myPolygon.VerticalAlignment   = VerticalAlignment.Center;
            PointCollection myPointCollection = new PointCollection();

            myPointCollection.Add(new Point(Originx, Originy));

            for (int i = FromAngle; i <= ToAngle; i = i + 1)
            {
                PolarPoint p1 = new PolarPoint(110.0, i);
                myPointCollection.Add(new Point(Originx + p1.X, Originy + p1.Y));
            }

            myPointCollection.Add(new Point(Originx, Originy));

            myPolygon.Points = myPointCollection;
            //    myCanvas.Children.Add(myPolygon);
            Canvas2.Children.Add(myPolygon);
        }