本文整理汇总了C#中System.Windows.Media.StreamGeometryContext.Close方法的典型用法代码示例。如果您正苦于以下问题:C# StreamGeometryContext.Close方法的具体用法?C# StreamGeometryContext.Close怎么用?C# StreamGeometryContext.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.StreamGeometryContext
的用法示例。
在下文中一共展示了StreamGeometryContext.Close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawArrowGeometry
/// <summary>
/// The actual method for drawing the arrow.
/// </summary>
/// <param name="StreamGeometryContext">Describes a geometry using drawing commands.</param>
protected override void DrawArrowGeometry(StreamGeometryContext StreamGeometryContext)
{
var theta = Math.Atan2(Y1 - Y2, X1 - X2);
var sint = Math.Sin(theta);
var cost = Math.Cos(theta);
var ArrowOrigin = new Point(X1, this.Y1);
var ArrowTarget = new Point(X2, this.Y2);
var pt3 = new Point(X2 + (HeadWidth * cost - HeadHeight * sint),
Y2 + (HeadWidth * sint + HeadHeight * cost));
var pt4 = new Point(X2 + (HeadWidth * cost + HeadHeight * sint),
Y2 - (HeadHeight * cost - HeadWidth * sint));
StreamGeometryContext.BeginFigure(ArrowOrigin, isFilled: true, isClosed: false);
StreamGeometryContext.LineTo (ArrowTarget, isStroked: true, isSmoothJoin: true);
StreamGeometryContext.LineTo (pt3, isStroked: true, isSmoothJoin: true);
StreamGeometryContext.LineTo (pt4, isStroked: true, isSmoothJoin: true);
StreamGeometryContext.LineTo (ArrowTarget, isStroked: true, isSmoothJoin: true);
StreamGeometryContext.Close();
}
示例2: displayRecord
public void displayRecord()
{
//Find maximum and minimum for this graphlet, in case needed for scaling
double max = double.NegativeInfinity;
double min = double.PositiveInfinity;
foreach (int channel in channels)
{
Multigraph.displayChannel dc = mg.displayedChannels.Where(n => n.channel == channel).First();
max = Math.Max(dc.max, max);
min = Math.Min(dc.min, min);
}
//Check to see if new Y-axis and grid needed
if(mg.individual)
if (mg.useAllYMax) drawYGrid(Math.Max(mg.allChanMax, -mg.allChanMin));
else if (!mg.fixedYMax) //then must be per graphlet max
drawYGrid(Math.Max(max,-min));
if (mg.individual) // make sure this is the only one
{
foreach (Plot pl in plots)
gCanvas.Children.Remove(pl.path);
plots.Clear();
graphletMax = double.MinValue;
graphletMin = double.MaxValue;
}
foreach (int channel in channels)
{
Multigraph.displayChannel dc = mg.displayedChannels.Where(n => n.channel == channel).First();
points = new StreamGeometry();
ctx = points.Open();
ctx.BeginFigure(new Point(0, offset - mg.gp.halfMargin - dc.buffer[0] * graphletYScale), false, false);
double maxY = 10D * MainWindow.graphletSize;
for (int x = 1; x < dc.buffer.GetLength(0); x++)
{
double y = offset - mg.gp.halfMargin - dc.buffer[x] * graphletYScale;
if (y > maxY) y = maxY; //limit size of displayed point
else if (y < -maxY) y = -maxY;
ctx.LineTo(new Point((double)x * graphletXScale, y), true, true);
}
ctx.Close();
points.Freeze();
Path p = new Path();
p.Stroke = channel == mg.highlightedChannel ? Brushes.Red : Brushes.Black;
p.StrokeThickness = channel == mg.highlightedChannel ? strokeThickness * 2D : strokeThickness;
p.StrokeLineJoin = PenLineJoin.Round;
p.SnapsToDevicePixels = false; //use anti-aliasing
p.Data = points;
gCanvas.Children.Add(p); //draw the plot onto graphlet
Plot pl = new Plot();
pl.path = p;
pl.channel = channel;
pl.recNumber = mg.RecSet;
pl.max = max;
graphletMax = Math.Max(graphletMax, max); //for superimposed records
pl.min = min;
graphletMin = Math.Min(graphletMin, min);
pl.gvList = mg.gvList;
plots.Add(pl);
}
}
示例3: DrawGeometry
/// <summary>
/// Draws the pie chart
/// </summary>
/// <param name="context"></param>
private void DrawGeometry(StreamGeometryContext context)
{
Point startPoint = new Point(CentreX, CentreY);
Point outerArcStartPoint = ComputeCartesianCoordinate(Rotation, Radius);
outerArcStartPoint.Offset(CentreX, CentreY);
Point outerArcEndPoint = ComputeCartesianCoordinate(Rotation + Angle, Radius);
outerArcEndPoint.Offset(CentreX, CentreY);
bool largeArc = Angle > 180.0;
Size outerArcSize = new Size(Radius, Radius);
context.BeginFigure(startPoint, true, true);
context.LineTo(outerArcStartPoint, true, true);
context.ArcTo(outerArcEndPoint, outerArcSize, 0, largeArc, SweepDirection.Clockwise, true, true);
context.Close();
}