【发布时间】:2023-04-10 08:12:01
【问题描述】:
我想知道如何在 C# 中绘制弧线,我正在尝试使用 DrawEllipse,但它不起作用,而且绘制错误。 但是,我在DrawingContext类中搜索了一种绘制圆弧的方法,但没有找到。
DrawingVisual d = new DrawingVisual();
System.Windows.Media.Pen pen = new System.Windows.Media.Pen();
DrawingContext drawingContext = d.RenderOpen();
pen.Brush = System.Windows.Media.Brushes.Black;
System.Windows.Point center = new System.Windows.Point();
center.X = 0.4;
center.Y = 0.5;
drawingContext.DrawEllipse(System.Windows.Media.Brushes.White, pen, center, 4,4);
drawingContext.Close();
canvas.Children.Add(new VisualHost { Visual = d });
【问题讨论】:
标签: c# wpf drawingcontext