只是想知道什么更轻,我将有一个绘制 280 * 4 我的 SegmentControl 的控件,即四分之一圆,我只是想知道绘制所述段所需内存最少的方法是什么。
几何绘图:
<Image>
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<GeometryDrawing Brush="LightBlue"
Geometry="M24.612317,0.14044853 C24.612317,0.14044853 33.499971,-0.60608719 41,7.0179795 48.37642,14.516393 47.877537,23.404541 47.877537,23.404541 L24.60978,23.401991 z" />
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
或路径:
<Path Fill="LightBlue"
Stretch="Fill"
Stroke="#FF0DA17D"
Data="M24.612317,0.14044853 C24.612317,0.14044853 33.499971,-0.60608719 41,7.0179795 48.37642,14.516393 47.877537,23.404541 47.877537,23.404541 L24.60978,23.401991 z" />
或者如果您知道更好的方法,我们将不胜感激。
谢谢!
如果你想要更好的性能,你可以研究“绘制视觉”。它更复杂,但也更性能。
但是,您需要了解如何绘制每个所需的形状。
样品:
// Create a DrawingVisual that contains a rectangle.
private DrawingVisual CreateDrawingVisualRectangle()
{
DrawingVisual drawingVisual = new DrawingVisual();
// Retrieve the DrawingContext in order to create new drawing content.
DrawingContext drawingContext = drawingVisual.RenderOpen();
// Create a rectangle and draw it in the DrawingContext.
Rect rect = new Rect(new System.Windows.Point(160, 100), new System.Windows.Size(320, 80));
drawingContext.DrawRectangle(System.Windows.Media.Brushes.LightBlue, (System.Windows.Media.Pen)null, rect);
// Persist the drawing content.
drawingContext.Close();
return drawingVisual;
}