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


C# CGContext.MoveTo方法代码示例

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


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

示例1: 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

示例2: DrawGridlines

 protected override void DrawGridlines(RectangleF rect, CGContext context)
 {
     float maxY = rect.Size.Height;
     for (float y = CellSize.Height; y < maxY; y += (CellSize.Height + Gridlines.Thickness))
     {
         context.MoveTo(rect.Left, y + 0.5f);
         context.AddLineToPoint(rect.Right, y + 0.5f);
     }
     context.StrokePath();
 }
开发者ID:abeiderman,项目名称:FrozenHeadersGrid_MonoTouch,代码行数:10,代码来源:GridHeaderColumnView.cs

示例3: DrawGridlines

 protected override void DrawGridlines(RectangleF rect, CGContext context)
 {
     float maxX = rect.Size.Width;
     float cellWidth = CellSize.Width;
     for (float x = cellWidth; x < maxX; x += (cellWidth + Gridlines.Thickness))
     {
         context.MoveTo(x + 0.5f, rect.Location.Y);
         context.AddLineToPoint(x + 0.5f, rect.Size.Height);
     }
     context.StrokePath();
 }
开发者ID:abeiderman,项目名称:FrozenHeadersGrid_MonoTouch,代码行数:11,代码来源:GridHeaderRowView.cs

示例4: addPath

		static void addPath(CGContext context, CGRect rect, float radius, RoundedCorner cornerMask)
		{
			context.MoveTo(rect.X, rect.Y + radius);
			context.AddLineToPoint(rect.X, rect.Y + rect.Height - radius);
			if (((int)cornerMask & (int)RoundedCorner.BottomLeft) != 0) {
				context.AddArc(rect.X + radius, rect.Y + rect.Height - radius, 
					radius, (nfloat)Math.PI, (nfloat)Math.PI / 2, true);
			}
			else {
				context.AddLineToPoint(rect.X, rect.Y + rect.Height);
				context.AddLineToPoint(rect.X + radius, rect.Y + rect.Height);
			}

			context.AddLineToPoint(rect.X + rect.Width - radius, 
				rect.Y + rect.Height);

			if (((int)cornerMask & (int)RoundedCorner.BottomRight) != 0) {
				context.AddArc(rect.X + rect.Width - radius, 
					rect.Y + rect.Height - radius, radius, (nfloat)Math.PI / 2, 0.0f, true);
			}
			else {
				context.AddLineToPoint(rect.X + rect.Width, rect.Y + rect.Height);
				context.AddLineToPoint(rect.X + rect.Width, rect.Y + rect.Height - radius);
			}

			context.AddLineToPoint(rect.X + rect.Width, rect.Y + radius);

			if (((int)cornerMask & (int)RoundedCorner.TopRight) != 0) {
				context.AddArc(rect.X + rect.Width - radius, rect.Y + radius, 
					radius, 0, -(nfloat)Math.PI / 2, true);
			}
			else {
				context.AddLineToPoint(rect.X + rect.Width, rect.Y);
				context.AddLineToPoint(rect.X + rect.Width - radius, rect.Y);
			}

			context.AddLineToPoint(rect.X + radius, rect.Y);

			if (((int)cornerMask & (int)RoundedCorner.TopLeft) != 0) {
				context.AddArc(rect.X + radius, rect.Y + radius, radius, 
					-(nfloat)Math.PI / 2, (nfloat)Math.PI, true);
			}
			else {
				context.AddLineToPoint(rect.X, rect.Y);
				context.AddLineToPoint(rect.X, rect.Y + radius);
			}

			context.ClosePath();
		}
开发者ID:fadafido,项目名称:tojeero,代码行数:49,代码来源:TabButtonRenderer.cs

示例5: DrawInContext

		public override void DrawInContext (CGContext ctx)
		{
			base.DrawInContext (ctx);
			
			var bounds = Bounds;
			var c = new PointF (bounds.GetMidX (), bounds.GetMidY ());
			
			ctx.BeginPath ();
			ctx.MoveTo (c.X, c.Y);
			ctx.AddLineToPoint (bounds.Right, c.Y);
			ctx.AddArc (c.X, c.Y, bounds.Width/2, (float)0, (float)Angle, false);
			ctx.AddLineToPoint (c.X, c.Y);
			ctx.SetFillColor (otherColor);
			ctx.FillPath ();
			
			ctx.BeginPath ();
			ctx.MoveTo (c.X, c.Y);
			ctx.AddLineToPoint (bounds.Right, c.Y);
			ctx.AddArc (c.X, c.Y, bounds.Width/2, (float)0, (float)(1e-7 + Angle), true);
			ctx.AddLineToPoint (c.X, c.Y);
			ctx.SetFillColor (color);
			ctx.FillPath ();
			
		}
开发者ID:GSerjo,项目名称:Seminars,代码行数:24,代码来源:PieChartLayer.cs

示例6: DrawInContext

	public override void DrawInContext (CGContext context)
	{
		context.SetRGBStrokeColor (1, 1, 1, 1f);
		
		// Draw lines with a stroke width from 1-10
		for (int i = 1; i <= 10; ++i) {
			context.SetLineWidth (i);
			context.MoveTo (10, (float) i * 20.5f);
			context.AddLineToPoint (310, (float)i * 20.5f);
			context.StrokePath ();
		}
		
		// Demonstration that stroke is even on both sides of the line
		context.SetLineWidth(15);
		context.MoveTo (10, 245.5f);
		context.AddLineToPoint (310, 245.5f);
		context.StrokePath ();
	
		context.SetRGBStrokeColor (1, 0, 0, 1);
		context.SetLineWidth (3);
		context.MoveTo (10, 245.5f);
		context.AddLineToPoint (310, 245.5f);
		context.StrokePath ();
	}	
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:24,代码来源:LineDrawing.cs

示例7: DrawStar

		/// <summary>
		/// Draws a star at the bottom left of the context of the specified diameter
		/// </summary>
		protected void DrawStar (CGContext context, float starDiameter)
		{
			// declare vars
			// 144º
			float theta = 2 * (float)Math.PI * (2f / 5f);
			float radius = starDiameter / 2;

			// move up and over
			context.TranslateCTM (starDiameter / 2, starDiameter / 2);

			context.MoveTo (0, radius);
			for (int i = 1; i < 5; i++) {
				context.AddLineToPoint (radius * (float)Math.Sin (i * theta), radius * (float)Math.Cos (i * theta));
			}
			//context.SetRGBFillColor (1, 1, 1, 1);
			context.ClosePath ();
			context.FillPath ();
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:21,代码来源:CameraOverlayView.cs

示例8: DrawStarPattern

		/// <summary>
		/// This is a slightly more complicated draw pattern, but using it is just 
		/// as easy as the previous one. To use this one, simply change "DrawPolkaDotPattern"
		/// in line 54 above to "DrawStarPattern"
		/// </summary>
		protected void DrawStarPattern (CGContext context)
		{
			// declare vars
			float starDiameter = 16;
			// 144º
			float theta = 2 * (float)Math.PI * (2f / 5f);
			float radius = starDiameter / 2;
			
			// move up and over
			context.TranslateCTM (starDiameter / 2, starDiameter / 2);
			
			context.MoveTo (0, radius);
			for (int i = 1; i < 5; i++) {
				context.AddLineToPoint (radius * (float)Math.Sin (i * theta), radius * (float)Math.Cos (i * theta));
			}
			// fill our star as dark gray
			context.ClosePath ();
			context.FillPath ();
		}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:24,代码来源:Controller.cs

示例9: Draw

        public override void Draw(RectangleF bounds, CGContext context, UIView view)
        {
            context.BeginPath();
			context.SetLineWidth(1.0f);
			context.SetStrokeColor(UIColor.FromRGB(199, 199, 205).CGColor);
			var x = (int)System.Math.Ceiling(bounds.Width / 2 - 0.5f);
			context.MoveTo(x, 0f);
			context.AddLineToPoint(x, bounds.Height);
            context.StrokePath();

            /*
            context.BeginPath();
            context.SetStrokeColor(UIColor.FromRGBA(250, 250, 250, 128).CGColor);
            context.MoveTo(bounds.Width / 2 + 0.5f, 0);
            context.AddLineToPoint(bounds.Width / 2 + 0.5f, bounds.Height);
            context.StrokePath();
            */

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

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

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

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

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

示例10: HatchShingle

        void HatchShingle(CGContext context)
        {
            var hatchWidth = getHatchWidth (hatchStyle);
            var hatchHeight = getHatchHeight (hatchStyle);
            var lineWidth = getLineWidth (hatchStyle);

            initializeContext(context, hatchHeight, false);

            /* draw background */
            drawBackground (context, backColor, hatchWidth, hatchHeight);

            /* draw lines in the foreground color */
            context.SetFillColor(foreColor.ToCGColor());
            context.SetStrokeColor(foreColor.ToCGColor());
            context.SetLineWidth(lineWidth);
            context.SetLineCap(CGLineCap.Square);

            float halfMe = hatchWidth / 2.0f;

            // We are basically going to draw a lamda sign

            // Draw base
            context.MoveTo(0,0);
            context.AddLineToPoint(halfMe,halfMe-HALF_PIXEL_Y);
            context.AddLineToPoint(hatchWidth, HALF_PIXEL_Y);
            context.StrokePath();

            // draw the first part of tail
            context.MoveTo(halfMe + HALF_PIXEL_X, halfMe);
            context.AddLineToPoint(halfMe + HALF_PIXEL_X, halfMe + 1);
            context.StrokePath();

            // now the last curl on the tail
            CGRect rect = new CGRect (1,hatchHeight-1,1,1);
            setPixels(context, rect);

            rect.X += 1;
            setPixels(context, rect);

            rect.X += 1;
            rect.Y -= 1;
            setPixels(context, rect);
        }
开发者ID:mono,项目名称:sysdrawing-coregraphics,代码行数:43,代码来源:HatchBrush.cs

示例11: SSDrawRoundedRect

		public void SSDrawRoundedRect(CGContext context, RectangleF rect, float cornerRadius)
		{
			var minx = rect.GetMinX();
			var midx = rect.GetMidX();
			var maxx = rect.GetMaxX();
			var miny = rect.GetMinY();
			var midy = rect.GetMidY();
			var maxy = rect.GetMaxY();
			context.MoveTo(minx, midy);
			context.AddArcToPoint(minx, miny, midx, miny, cornerRadius);
			context.AddArcToPoint(maxx, miny, maxx, midy, cornerRadius);
			context.AddArcToPoint(maxx, maxy, midx, maxy, cornerRadius);
			context.AddArcToPoint(minx, maxy, minx, midy, cornerRadius);
			context.ClosePath();
			context.FillPath();
		}
开发者ID:modulexcite,项目名称:artapp,代码行数:16,代码来源:BadgeView.cs

示例12: HatchDiagonalCross

        void HatchDiagonalCross(CGContext context)
        {
            var hatchWidth = getHatchWidth (hatchStyle);
            var hatchHeight = getHatchHeight (hatchStyle);
            var lineWidth = getLineWidth (hatchStyle);

            initializeContext(context, hatchHeight, true);

            /* draw background */
            drawBackground (context, backColor, hatchWidth, hatchHeight);

            /* draw lines in the foreground color */
            context.SetStrokeColor(foreColor.ToCGColor());
            context.SetLineWidth(lineWidth);
            context.SetLineCap(CGLineCap.Square);

            float halfMe = hatchHeight / 2.0f;

            context.MoveTo(0, 0);
            context.AddLineToPoint(hatchWidth, hatchHeight);
            context.StrokePath();

            context.MoveTo(hatchWidth, 0);
            context.AddLineToPoint(0, hatchHeight);
            context.StrokePath();
        }
开发者ID:mono,项目名称:sysdrawing-coregraphics,代码行数:26,代码来源:HatchBrush.cs

示例13: HatchDiagonalBrick

        void HatchDiagonalBrick(CGContext context)
        {
            var hatchWidth = getHatchWidth (hatchStyle);
            var hatchHeight = getHatchHeight (hatchStyle);
            var lineWidth = getLineWidth (hatchStyle);

            initializeContext(context, hatchHeight, false);

            /* draw background */
            drawBackground (context, backColor, hatchWidth, hatchHeight);

            /* draw lines in the foreground color */
            context.SetStrokeColor(foreColor.ToCGColor());
            context.SetLineWidth(lineWidth);
            context.SetLineCap(CGLineCap.Square);

            hatchHeight -= 1;
            hatchWidth -= 1;

            context.MoveTo(0, 0);
            context.AddLineToPoint(hatchWidth,hatchHeight);
            context.StrokePath();

            context.MoveTo(0, hatchHeight);
            context.AddLineToPoint(hatchWidth / 2.0f,hatchHeight / 2.0f);
            context.StrokePath();
        }
开发者ID:mono,项目名称:sysdrawing-coregraphics,代码行数:27,代码来源:HatchBrush.cs

示例14: HatchDashedHorizontal

        void HatchDashedHorizontal(CGContext context)
        {
            var hatchWidth = getHatchWidth (hatchStyle);
            var hatchHeight = getHatchHeight (hatchStyle);
            var lineWidth = getLineWidth (hatchStyle);

            initializeContext(context, hatchHeight, false);

            /* draw background */
            drawBackground (context, backColor, hatchWidth, hatchHeight);

            /* draw lines in the foreground color */
            context.SetStrokeColor(foreColor.ToCGColor());
            context.SetLineWidth(lineWidth);
            context.SetLineCap(CGLineCap.Square);

            float halfMe = hatchHeight / 2.0f - 1;
            hatchWidth -=1;
            hatchHeight -= 1;

            context.MoveTo(halfMe+1, halfMe);
            context.AddLineToPoint(hatchWidth, halfMe);
            context.StrokePath();

            context.MoveTo(0,hatchHeight);
            context.AddLineToPoint(halfMe, hatchHeight);
            context.StrokePath();
        }
开发者ID:mono,项目名称:sysdrawing-coregraphics,代码行数:28,代码来源:HatchBrush.cs

示例15: HatchVertical

        protected void HatchVertical(CGContext context)
        {
            var hatchSize = getHatchWidth (hatchStyle);
            var lineWidth = getLineWidth (hatchStyle);

            initializeContext(context, hatchSize, false);

            /* draw background */
            drawBackground (context, backColor, hatchSize, hatchSize);

            /* draw horizontal line in the foreground color */
            context.SetStrokeColor(foreColor.ToCGColor());
            context.SetLineWidth(lineWidth);
            context.SetLineCap(CGLineCap.Square);

            float halfMe = hatchSize / 2.0f;

            // draw a horizontal line
            context.MoveTo(0, 0);
            context.AddLineToPoint(0, hatchSize);

            context.StrokePath();
        }
开发者ID:mono,项目名称:sysdrawing-coregraphics,代码行数:23,代码来源:HatchBrush.cs


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