本文整理汇总了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);
}
示例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);
}