本文整理汇总了C#中ICanvas.DrawPath方法的典型用法代码示例。如果您正苦于以下问题:C# ICanvas.DrawPath方法的具体用法?C# ICanvas.DrawPath怎么用?C# ICanvas.DrawPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICanvas
的用法示例。
在下文中一共展示了ICanvas.DrawPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawElement
protected override void DrawElement(ICanvas canvas)
{
canvas.DrawPath (Operations, Pen, Brush);
}
示例2: Draw
public override void Draw(ICanvas canvas, Rect rect)
{
if(DrawingFunction != null)
{
base.Draw(canvas, rect);
return;
}
var borderColro = NGraphics.Color.FromHSL(
BorderColor.Hue,
BorderColor.Saturation,
BorderColor.Luminosity,
BorderColor.A);
var pen = new Pen(borderColro, BorderWidth);
var fillColor = NGraphics.Color.FromHSL(
BackColor.Hue,
BackColor.Saturation,
BackColor.Luminosity,
BackColor.A);
var brush = new SolidBrush(fillColor);
var padding = BorderWidth <= 0 ? 0.0 : BorderWidth;
var newRect = rect.GetInflated(-padding);
var curveSize = newRect.Height / 2;
canvas.DrawPath(new PathOp []{
new MoveTo(newRect.Left+curveSize, newRect.Top),
new LineTo(newRect.Right-curveSize, newRect.Top),
new CurveTo(
new NGraphics.Point(newRect.Right-curveSize, newRect.Top),
newRect.TopRight,
new NGraphics.Point(newRect.Right, newRect.Top+curveSize)
),
new CurveTo(
new NGraphics.Point(newRect.Right, newRect.Bottom-curveSize),
newRect.BottomRight,
new NGraphics.Point(newRect.Right-curveSize, newRect.Bottom)
),
new LineTo(newRect.Left+curveSize, newRect.Bottom),
new CurveTo(
new NGraphics.Point(newRect.Left+curveSize, newRect.Bottom),
newRect.BottomLeft,
new NGraphics.Point(newRect.Left, newRect.Bottom-curveSize)
),
new CurveTo(
new NGraphics.Point(newRect.Left, newRect.Top+curveSize),
newRect.TopLeft,
new NGraphics.Point(newRect.Left+curveSize, newRect.Top)
),
new ClosePath()
}, pen, brush);
}