当前位置: 首页>>代码示例>>C#>>正文


C# UIColor.SetStroke方法代码示例

本文整理汇总了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;
		}
开发者ID:JackWangCUMT,项目名称:FlatUI.iOS,代码行数:14,代码来源:ImageHelper.cs

示例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);
        }
开发者ID:natecook1000,项目名称:FlatUIKit.Xamarin,代码行数:22,代码来源:FlatUI.cs

示例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);
        }
开发者ID:natecook1000,项目名称:FlatUIKit.Xamarin,代码行数:24,代码来源:FlatUI.cs


注:本文中的UIColor.SetStroke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。