WPF C# Canvas上绘制文字
作者:互联网
private void drawText(double x, double y, string text, Color color,Canvas canvasObj) { TextBlock textBlock = new TextBlock(); textBlock.Text = text; textBlock.Foreground = new SolidColorBrush(color); Canvas.SetLeft(textBlock, x); Canvas.SetTop(textBlock, y); canvasObj.Children.Add(textBlock); }
drawText(l.X1, l.Y1,"Text", Color.FromRgb(200, 0, 0), myCanvas);
标签:Canvas,C#,text,drawText,textBlock,new,WPF,color 来源: https://www.cnblogs.com/guangzhiruijie/p/16521492.html