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


C# CGContext.StrokeLineSegments方法代码示例

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


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

示例1: DrawInContext

	public override void DrawInContext (CGContext context)
	{
		// Draw lines with a white stroke color
		context.SetRGBStrokeColor (1f, 1f, 1f, 1f);

		// Draw them with a 2.0 stroke width so they are more visible
		context.SetLineWidth (2);

		context.MoveTo (10, 30);
		context.AddLineToPoint (310, 30);
		context.StrokePath ();

		// Draw connected sequence of lines
		var points = new PointF [] {
			new PointF (10, 90),
			new PointF (70, 60),
			new PointF (130, 90),
			new PointF (190, 60),
			new PointF (250, 90),
			new PointF (310, 60)
		};
		
		context.AddLines (points);
		context.StrokePath ();

		var segments = new PointF [] {
			new PointF (10, 150),
			new PointF (70, 120),
			new PointF (130, 150),
			new PointF (190, 120),
			new PointF (250, 150),
			new PointF (310, 120),
		};

		// Bulk call to stroke a sequence of line segments

		context.StrokeLineSegments (segments);
	}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:38,代码来源:LineDrawing.cs

示例2: DrawLayer

				public override void DrawLayer (CALayer layer, CGContext context)
				{
					// Fill in the background
					//GraphView gView = new GraphView ();
					context.SetFillColor (GraphBackgroundColour ());
					context.FillRect (layer.Bounds);

					// Draw the grid lines
					DrawGridLines (context, 0.0f, 32.0f);

					//Draw the graph
					CGPoint[] lines = new CGPoint[64];
					int i;

					//X
					for (i = 0; i < 32; ++i) {
						lines [i * 2].X = i;
						lines [i * 2].Y = ((float)(_parent.xhistory [i] * (-1)) * 16.0f);
						lines [(i * 2 + 1)].X = i + 1;
						lines [(i * 2 + 1)].Y = ((float)(_parent.xhistory [i + 1] * (-1)) * 16.0f);
					}

					context.SetStrokeColor (GraphXColor ());
					context.StrokeLineSegments (lines);

					//Y
					for (i = 0; i < 32; ++i) {
						lines [i * 2].Y = ((float)(_parent.yhistory [i] * (-1)) * 16.0f);
						lines [(i * 2 + 1)].Y = ((float)(_parent.yhistory [i + 1] * (-1)) * 16.0f);
					}

					context.SetStrokeColor (GraphYColor ());
					context.StrokeLineSegments (lines);

					//Z
					for (i = 0; i < 32; ++i) {
						lines [i * 2].Y = ((float)(_parent.zhistory [i] * (-1)) * 16.0f);
						lines [(i * 2 + 1)].Y = ((float)(_parent.zhistory [i + 1] * (-1)) * 16.0f);
					}

					context.SetStrokeColor (GraphZColor ());
					context.StrokeLineSegments (lines);
				}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:43,代码来源:GraphView.cs


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