本文整理汇总了C#中UIColor.SetStroke方法的典型用法代码示例。如果您正苦于以下问题:C# UIColor.SetStroke方法的具体用法?C# UIColor.SetStroke怎么用?C# UIColor.SetStroke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIColor
的用法示例。
在下文中一共展示了UIColor.SetStroke方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CircularImageWithColor
public static UIImage CircularImageWithColor(UIColor color, SizeF size){
var rect = new RectangleF(0,0, size.Width, size.Height);
var circle = UIBezierPath.FromOval (rect);
UIGraphics.BeginImageContextWithOptions (rect.Size, false, 0f);
color.SetFill ();
color.SetStroke ();
circle.AddClip ();
circle.Fill ();
circle.Stroke ();
var image = UIGraphics.GetImageFromCurrentImageContext ();
UIGraphics.EndImageContext ();
return image;
}
示例2: BackButtonImage
public static UIImage BackButtonImage(UIColor color, UIBarMetrics metrics, float cornerRadius, UIColor borderColor, float borderWidth)
{
SizeF size;
if (metrics.Equals(UIBarMetrics.Default))
size = new SizeF(50, 30);
else
size = new SizeF(60, 23);
UIBezierPath fillPath = BezierPathForBackButton(new RectangleF(0, 0, size.Width, size.Height), cornerRadius);
fillPath.LineWidth = 2 * borderWidth;
UIGraphics.BeginImageContextWithOptions(size, false, 0f);
color.SetFill();
borderColor.SetStroke();
fillPath.AddClip();
fillPath.Fill();
if (borderWidth > 0)
fillPath.Stroke();
UIImage image = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
return image.CreateResizableImage(new UIEdgeInsets(cornerRadius, 15f, cornerRadius, cornerRadius), UIImageResizingMode.Stretch);
}
示例3: Image
public static UIImage Image(UIColor color, float cornerRadius, UIColor borderColor, float borderWidth)
{
float minEdgeSize = EdgeSize(cornerRadius);
RectangleF rect = new RectangleF(0, 0, minEdgeSize, minEdgeSize);
UIBezierPath fillPath = UIBezierPath.FromRoundedRect(rect, cornerRadius);
UIBezierPath strokePath = fillPath;
if (borderWidth > 0)
{
RectangleF insetRect = RectangleF.Inflate(rect, -1 * borderWidth / 2, -1 * borderWidth / 2);
strokePath = UIBezierPath.FromRoundedRect(insetRect, cornerRadius);
}
UIGraphics.BeginImageContextWithOptions(rect.Size, false, 0f);
color.SetFill();
borderColor.SetStroke();
fillPath.Fill();
if (borderWidth > 0)
strokePath.Stroke();
fillPath.AddClip();
UIImage image = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
return image.CreateResizableImage(new UIEdgeInsets(cornerRadius, cornerRadius, cornerRadius, cornerRadius), UIImageResizingMode.Stretch);
}