本文整理匯總了C#中NGraphics.Rect.GetInflated方法的典型用法代碼示例。如果您正苦於以下問題:C# Rect.GetInflated方法的具體用法?C# Rect.GetInflated怎麽用?C# Rect.GetInflated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NGraphics.Rect
的用法示例。
在下文中一共展示了Rect.GetInflated方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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);
}