WPF画辐射图

   public void WriteLineCircle(double originX, double originY, double r, int lineCount,List<string> list)
        {
            for (int i = 0; i < lineCount; i++)
            {
                list.Add("你好");
                double xget = Math.Cos(2*Math.PI*i / lineCount)*r;
                double yget = Math.Sin(2*Math.PI * i / lineCount)*r;
                can.Children.Add(DrawLine(originX, originY, originX + xget, originY+yget, new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF0000")), 2));//
                TextBlock text = new TextBlock();
                text.Margin = new Thickness(originX + xget, originY + yget, 0, 0);
                text.Text = list[i];
                can.Children.Add(text);
            }
        }

        public Path DrawLine(double startX, double startY, double endXL, double endYL, Brush color, double thickness)
        {
            Path path = new Path
            {
                Stroke = color,
                StrokeThickness = thickness
            };
            LineGeometry line = new LineGeometry
            {
                StartPoint = new Point(startX, startY),
                EndPoint = new Point(endXL, endYL)
            };
            path.Data = line;
            return path;
        }
 <Canvas Height="800" Width="800" Name="can" Background="Azure"></Canvas>

 

posted @ 2018-12-25 14:33  张统  阅读(595)  评论(0)    收藏  举报