本文整理汇总了C#中System.Windows.Thickness.LeftF方法的典型用法代码示例。如果您正苦于以下问题:C# Thickness.LeftF方法的具体用法?C# Thickness.LeftF怎么用?C# Thickness.LeftF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Thickness
的用法示例。
在下文中一共展示了Thickness.LeftF方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawRect
private void DrawRect(CGContext g, CGRect rect, Thickness borderThickness, Brush borderBrush, Brush fill, CornerRadius cornerRadius)
{
var center = new CGPoint(rect.Left + cornerRadius.TopLeft + borderThickness.Left / 2, rect.Top + cornerRadius.TopLeft + borderThickness.Top / 2);
var strokeColor = borderBrush != null ? borderBrush.ToUIColor(rect.Size).CGColor : UIColor.Black.CGColor;
g.SetStrokeColor(strokeColor);
g.SetFillColor(strokeColor);
List<Arc> innerArcs = new List<Arc>();
if (cornerRadius.TopLeft != 0)
{
innerArcs.Add(this.DrawArc(g, cornerRadius.TopLeft, center, borderThickness.LeftF(), borderThickness.TopF(), 180f, 270f));
}
else
{
innerArcs.Add(new Arc() { Center = center });
}
g.BeginPath();
g.SetLineWidth(borderThickness.TopF());
g.MoveTo((nfloat)cornerRadius.TopLeft, borderThickness.TopF() / 2);
g.AddLineToPoint(rect.Right - (nfloat)cornerRadius.TopRight - borderThickness.RightF() / 2, borderThickness.TopF() / 2);
g.StrokePath();
center = new CGPoint(rect.Right - cornerRadius.TopRight - borderThickness.Right / 2, rect.Top + cornerRadius.TopRight + borderThickness.Top / 2);
if (cornerRadius.TopRight != 0)
{
innerArcs.Add(this.DrawArc(g, cornerRadius.TopRight, center, borderThickness.TopF(), borderThickness.RightF(), -90f, 0f));
}
else
{
innerArcs.Add(new Arc { Center = center });
}
g.BeginPath();
g.SetLineWidth(borderThickness.RightF());
g.MoveTo(rect.Right - borderThickness.RightF() / 2, (nfloat)cornerRadius.TopRight);
g.AddLineToPoint(rect.Right - borderThickness.RightF() / 2, rect.Height - (nfloat)cornerRadius.BottomRight);
g.StrokePath();
center = new CGPoint(rect.Right - cornerRadius.BottomRight - borderThickness.Right / 2, rect.Bottom - cornerRadius.BottomRight - borderThickness.Bottom / 2);
if (cornerRadius.BottomRight != 0)
{
innerArcs.Add(this.DrawArc(g, cornerRadius.BottomRight, center, borderThickness.RightF(), borderThickness.BottomF(), 0f, 90f));
}
else
{
innerArcs.Add(new Arc() { Center = center });
}
g.BeginPath();
g.SetLineWidth(borderThickness.BottomF());
g.MoveTo(rect.Right - (nfloat)cornerRadius.BottomRight, rect.Bottom - borderThickness.BottomF() / 2);
g.AddLineToPoint(rect.Left + (nfloat)cornerRadius.BottomLeft, rect.Bottom - borderThickness.BottomF() / 2);
g.StrokePath();
center = new CGPoint((rect.Left + cornerRadius.BottomLeft + borderThickness.Left / 2), (rect.Bottom - cornerRadius.BottomLeft - borderThickness.Bottom / 2));
if (cornerRadius.BottomLeft != 0)
{
innerArcs.Add(this.DrawArc(g, cornerRadius.BottomLeft, center, borderThickness.BottomF(), borderThickness.LeftF(), 90f, 180f));
}
else
{
innerArcs.Add(new Arc() { Center = center });
}
g.SetLineWidth((nfloat)borderThickness.Left);
g.MoveTo(rect.Left + borderThickness.LeftF() / 2, rect.Bottom - (nfloat)cornerRadius.BottomLeft);
g.AddLineToPoint(rect.Left + borderThickness.LeftF() / 2, rect.Top + (nfloat)cornerRadius.TopLeft);
g.StrokePath();
if (fill != null)
{
var fillColor = fill.ToUIColor(rect.Size).CGColor;
g.SetFillColor(fillColor);
g.SetLineWidth(0);
using (CGPath path = new CGPath())
{
path.AddArc(
innerArcs[0].Center.X,
innerArcs[0].Center.Y,
innerArcs[0].Radius,
innerArcs[0].EndingAngle,
innerArcs[0].StartingAngle,
false);
path.AddArc(
innerArcs[1].Center.X,
innerArcs[1].Center.Y,
innerArcs[1].Radius,
innerArcs[1].EndingAngle,
innerArcs[1].StartingAngle,
false);
path.AddArc(
innerArcs[2].Center.X,
innerArcs[2].Center.Y,
innerArcs[2].Radius,
innerArcs[2].EndingAngle,
innerArcs[2].StartingAngle,
false);
path.AddArc(
innerArcs[3].Center.X,
innerArcs[3].Center.Y,
innerArcs[3].Radius,
innerArcs[3].EndingAngle,
innerArcs[3].StartingAngle,
false);
//.........这里部分代码省略.........