• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CGContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CGContext的典型用法代码示例。如果您正苦于以下问题:C# CGContext类的具体用法?C# CGContext怎么用?C# CGContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CGContext类属于命名空间,在下文中一共展示了CGContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DrawBorders

        void DrawBorders(CGContext context, nfloat xMin, nfloat xMax, nfloat yMin, nfloat yMax, nfloat fWidth, nfloat fHeight)
        {
            if (BorderColorTop != null)
            {
                context.SetFillColor(BorderColorTop.CGColor);
                context.FillRect(new CGRect(xMin, yMin, fWidth, BorderWidth.Top));
            }

            if (BorderColorLeft != null)
            {
                context.SetFillColor(BorderColorLeft.CGColor);
                context.FillRect(new CGRect(xMin, yMin, BorderWidth.Left, fHeight));
            }

            if (BorderColorRight != null)
            {
                context.SetFillColor(BorderColorRight.CGColor);
                context.FillRect(new CGRect(xMax - BorderWidth.Right, yMin, BorderWidth.Right, fHeight));
            }

            if (BorderColorBottom != null)
            {
                context.SetFillColor(BorderColorBottom.CGColor);
                context.FillRect(new CGRect(xMin, yMax - BorderWidth.Bottom, fWidth, BorderWidth.Bottom));
            }
        }
开发者ID:KiranKumarAlugonda,项目名称:TXTSHD,代码行数:26,代码来源:DrawBorder.cs


示例2: GraphicsContextWrapper

		public GraphicsContextWrapper(CGContext context, float boundsWidth, float boundsHeight, BasicRectangle dirtyRect)
		{
			Context = context;
			BoundsWidth = boundsWidth;
			BoundsHeight = boundsHeight;
			DirtyRect = dirtyRect;
		}
开发者ID:pascalfr,项目名称:MPfm,代码行数:7,代码来源:GraphicsContextWrapper.cs


示例3: CreateShape

        public override void CreateShape(CGPath path, CGContext gctx)
        {
            path.AddRect (new RectangleF (_origin, new SizeF (100, 100)));
            gctx.AddPath (path);

            gctx.DrawPath (CGPathDrawingMode.FillStroke);
        }
开发者ID:martinbowling,项目名称:iBabySmash,代码行数:7,代码来源:SquareView.cs


示例4: Draw

        public override void Draw(CGRect bounds, CGContext context, UIView view)
        {
            var width = 0.5f / UIScreen.MainScreen.Scale;
            context.BeginPath();
            context.SetLineWidth(width);
            context.SetStrokeColor(UIColor.FromRGB(150, 150, 154).CGColor);
            var x = bounds.Width / 2f - width;
			context.MoveTo(x, 0f);
			context.AddLineToPoint(x, bounds.Height);
            context.StrokePath();

            var row = Value;
            var half = bounds.Height / 2;
            var halfText = _font.LineHeight / 2 + 1;

            row.Image1.Draw(new CGRect(15, half - 8f, 16f, 16f));

            if (!string.IsNullOrEmpty(row.Text1))
            {
                UIColor.Gray.SetColor();
                new NSString(row.Text1).DrawString(new CGRect(36,  half - halfText, bounds.Width / 2 - 40, _font.LineHeight), _font, UILineBreakMode.TailTruncation);
            }

            row.Image2.Draw(new CGRect(bounds.Width / 2 + 15, half - 8f, 16f, 16f));

            if (!string.IsNullOrEmpty(row.Text2))
            {
                UIColor.Gray.SetColor();
                new NSString(row.Text2).DrawString(new CGRect(bounds.Width / 2 + 36,  half - halfText, bounds.Width / 2 - 40, _font.LineHeight), _font, UILineBreakMode.TailTruncation);
            }
        }
开发者ID:Jeff-Lewis,项目名称:CodeBucket,代码行数:31,代码来源:SplitElement.cs


示例5: Draw

        public override void Draw(RectangleF bounds, CGContext context, UIView view)
        {
            UIColor.White.SetFill ();
            context.FillRect (bounds);

            context.DrawLinearGradient (
                gradient,
                new PointF (bounds.Left, bounds.Top),
                new PointF (bounds.Left, bounds.Bottom),
                CGGradientDrawingOptions.DrawsAfterEndLocation
            );

            UIColor.DarkGray.SetColor ();
            view.DrawString (
                this.Label,
                new RectangleF (10, 10, bounds.Width / 2, 10),
                captionFont,
                UILineBreakMode.TailTruncation
            );

            UIColor.Black.SetColor ();
            view.DrawString (
                this.Number.ToString (),
                new RectangleF (bounds.Width / 2, 10, (bounds.Width / 2) - 10, 10),
                amountFont,
                UILineBreakMode.TailTruncation,
                UITextAlignment.Right
            );
        }
开发者ID:rajeshwarn,项目名称:GhostPractice-iPadRepo,代码行数:29,代码来源:NumberElement.cs


示例6: Draw

		public override void Draw (RectangleF bounds, CGContext context, UIView view)
		{
			//UIColor.White.SetFill ();
			//context.FillRect (bounds);
			try
			{
				UIView searchView = view.ViewWithTag(1);				
				if (searchView == null)
				{
					var photoCellView = new PhotoCellView(_images, cellIndex, null);										
					
					photoCellView.Tag = 1;
					view.Add(photoCellView);
				}
				else
				{
					var photoCellView = (PhotoCellView)searchView;					
					photoCellView.Update(_images, cellIndex);
					
					photoCellView.DrawBorder(UIColor.Green);
				}
			}
			catch (Exception ex)
			{
				Util.LogException("Draw ImagesElement", ex);
			}
		}
开发者ID:21Off,项目名称:21Off,代码行数:27,代码来源:ImagesElement.cs


示例7: DrawInContext

		public override void DrawInContext (CGContext ctx)
		{
			UIGraphics.PushContext (ctx);
			CGRect bounds = this.Bounds;
			TKFill fill = this.LabelStyle.Fill;
			TKStroke stroke = new TKStroke (UIColor.Black);
			TKBalloonShape shape = new TKBalloonShape (TKBalloonShapeArrowPosition.Bottom ,new CGSize(bounds.Size.Width - stroke.Width, bounds.Size.Height - stroke.Width));
			CGRect textRect;
			if (this.IsOutsideBounds == true) {
				shape.ArrowPosition = TKBalloonShapeArrowPosition.Top;
				textRect = new CGRect (bounds.Left, bounds.Top - this.LabelStyle.Insets.Top + shape.ArrowSize.Height, bounds.Size.Width, bounds.Size.Height + this.LabelStyle.Insets.Bottom);
			} else {
				textRect = new CGRect (bounds.Left, bounds.Top - this.LabelStyle.Insets.Top, bounds.Size.Width, bounds.Size.Height + this.LabelStyle.Insets.Bottom);
			}

			shape.DrawInContext (ctx, new CGPoint (bounds.GetMidX (), bounds.GetMidY ()), new TKDrawing[]{ fill, stroke });
			NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle ();
			paragraphStyle.Alignment = this.LabelStyle.TextAlignment;
			NSDictionary attributes = new NSDictionary (UIStringAttributeKey.Font, UIFont.SystemFontOfSize (18),
				UIStringAttributeKey.ForegroundColor, this.LabelStyle.TextColor, 
				UIStringAttributeKey.ParagraphStyle, paragraphStyle);

			NSString text = new NSString (this.Text);
			text.WeakDrawString (textRect, NSStringDrawingOptions.TruncatesLastVisibleLine | NSStringDrawingOptions.UsesLineFragmentOrigin, attributes, null);
			UIGraphics.PopContext ();
		}
开发者ID:tremors,项目名称:ios-sdk,代码行数:26,代码来源:SelectedPointLabel.cs


示例8: DrawMapRect

 /// <summary>
 /// Draws the map rectangle.
 /// </summary>
 /// <param name="mapRect">Map rectangle.</param>
 /// <param name="zoomScale">Zoom scale.</param>
 /// <param name="context"> Graphics context.</param>
 public override void DrawMapRect(MKMapRect mapRect, nfloat zoomScale, CGContext context)
 {
     base.DrawMapRect(mapRect, zoomScale, context);
     var multiPolygons = (MultiPolygon)this.polygonOverlay;
     foreach (var item in multiPolygons.Polygons)
     {
         var path = new CGPath();
         this.InvokeOnMainThread(() =>
             {
                 path = PolyPath(item.Polygon);
             });
         if (path != null)
         {
             context.SetFillColor(item.FillColor);
             context.BeginPath();
             context.AddPath(path);
             context.DrawPath(CGPathDrawingMode.EOFill);
             if (item.DrawOutlines)
             {
                 context.BeginPath();
                 context.AddPath(path);
                 context.StrokePath();
             }
         }
     }
 }
开发者ID:MilenPavlov,项目名称:treewatch,代码行数:32,代码来源:MultiPolygonView.cs


示例9: Draw

 public override void Draw(CGRect bounds, CGContext context, UIView view)
 {
     if (AutoLoadOnVisible)
     {
         LoadMore();
     }
 }
开发者ID:Jeff-Lewis,项目名称:CodeBucket,代码行数:7,代码来源:LoadMoreElement.cs


示例10: DrawInContext

		public override void DrawInContext (CGContext context)
		{
			base.DrawInContext (context);
			
			context.AddEllipseInRect (Bounds);
			context.SetFillColor (ClockColor);
			context.FillPath ();
		}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:8,代码来源:ClockLayer.cs


示例11: DrawOutline

	    private static void DrawOutline(CGContext currentContext, IStyle style, CGRect destination)
		{
			var vectorStyle = (style as VectorStyle);
			if (vectorStyle == null) return;
			if (vectorStyle.Outline == null) return;
			if (vectorStyle.Outline.Color == null) return;
			DrawRectangle(currentContext, destination, vectorStyle.Outline.Color);
		}
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:8,代码来源:PointRenderer.cs


示例12: DrawInContext

        public override void DrawInContext(CGContext ctx)
        {
            UIGraphics.PushContext(ctx);

            Draw(Bounds);

            UIGraphics.PopContext();
        }
开发者ID:kraigspear,项目名称:ProgressView,代码行数:8,代码来源:CircularProgressView.cs


示例13: ShowCenteredTextAtPoint

		protected void ShowCenteredTextAtPoint (CGContext context, float centerX, float y, string text, int textHeight)
		{
			context.SelectFont ("Helvetica-Bold", textHeight, CGTextEncoding.MacRoman);
			context.SetTextDrawingMode (CGTextDrawingMode.Invisible);
			context.ShowTextAtPoint (centerX, y, text, text.Length);
			context.SetTextDrawingMode (CGTextDrawingMode.Fill);
			context.ShowTextAtPoint (centerX - (context.TextPosition.X - centerX) / 2, y, text, text.Length);
		}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:8,代码来源:View.cs


示例14: Draw

        public override void Draw(RectangleF bounds, CGContext context, UIView view)
        {
            UIColor.DarkGray.SetFill();
            context.FillRect(bounds);

            UIColor.Yellow.SetColor();
            view.DrawString(_text, new RectangleF(10, 15, bounds.Width - 20, bounds.Height - 30), UIFont.BoldSystemFontOfSize(14.0f), UILineBreakMode.TailTruncation);
        }
开发者ID:unsliced,项目名称:head-race-management,代码行数:8,代码来源:TimingDetailViewController.cs


示例15: Draw

        public void Draw(CGContext context)
        {
            if (DateTime.Now - CreatedTime < delaySpan)
                return;

            DrawBackground(context);
            DrawLines(context);
            DrawModel(context);
        }
开发者ID:ThunderMasta,项目名称:DyedSudoku,代码行数:9,代码来源:DialogViewModel.cs


示例16: DrawEllipsis

 public static void DrawEllipsis(CGContext context, RectangleF rect, CGColor color, float lineWidth)
 {
     context.SaveState();
     context.SetStrokeColor(color);
     context.SetLineWidth(lineWidth);
     context.AddEllipseInRect(rect);
     context.StrokePath();
     context.RestoreState();
 }
开发者ID:pascalfr,项目名称:MPfm,代码行数:9,代码来源:CoreGraphicsHelper.cs


示例17: FillRect

 public static void FillRect(CGContext context, RectangleF rect, CGColor color)
 {
     context.SaveState();
     context.AddRect(rect);
     context.Clip();
     context.SetFillColor(color);
     context.FillRect(rect);
     context.RestoreState();
 }
开发者ID:pascalfr,项目名称:MPfm,代码行数:9,代码来源:CoreGraphicsHelper.cs


示例18: DrawMapRect

 public override void DrawMapRect(MKMapRect mapRect, float zoomScale, CGContext context)
 {
     if(_polygon != null)
         DrawPolygon(_polygon,mapRect,zoomScale,context);
     else
         foreach(var polygon in _polygons)
         {
             DrawPolygon(polygon,mapRect,zoomScale,context);
         }
 }
开发者ID:Clancey,项目名称:ClanceyLib,代码行数:10,代码来源:PolygonOverlay.cs


示例19: DrawGradient

 protected override void DrawGradient(RectangleF rect, CGContext context)
 {
     context.DrawLinearGradient(new CGGradient(CGColorSpace.CreateDeviceRGB(),
                                               new CGColor[] {
         TintColor.CGColor,
         TintColor.Darken(TintDarkenFactor).CGColor
     }),
                                new PointF(0.5f, rect.Top),
                                new PointF(0.5f, rect.Bottom), 0);
 }
开发者ID:abeiderman,项目名称:FrozenHeadersGrid_MonoTouch,代码行数:10,代码来源:GridHeaderRowView.cs


示例20: Draw

		public override void Draw(RectangleF bounds, CGContext context, UIView view)
		{
			UIColor.White.SetFill();
			context.FillRect(bounds);
			
			context.DrawLinearGradient(gradient, new PointF(bounds.Left, bounds.Top), new PointF(bounds.Left, bounds.Bottom), CGGradientDrawingOptions.DrawsAfterEndLocation);
			
			UIColor.DarkGray.SetColor();
			view.DrawString(Caption, new RectangleF(10, 10, bounds.Width - 20, TextHeight(bounds)), _CaptionFont, UILineBreakMode.WordWrap);
		}
开发者ID:briandonahue,项目名称:MonoTouch.MVVM,代码行数:10,代码来源:MovieElement.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CGGradient类代码示例发布时间:2022-05-24
下一篇:
C# CGBitmapContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap