本文整理汇总了C#中System.Drawing.Drawing2D.GraphicsPath.AddCurve方法的典型用法代码示例。如果您正苦于以下问题:C# System.Drawing.Drawing2D.GraphicsPath.AddCurve方法的具体用法?C# System.Drawing.Drawing2D.GraphicsPath.AddCurve怎么用?C# System.Drawing.Drawing2D.GraphicsPath.AddCurve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Drawing2D.GraphicsPath
的用法示例。
在下文中一共展示了System.Drawing.Drawing2D.GraphicsPath.AddCurve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawSeries
//.........这里部分代码省略.........
foreach (var p in _serPoints)
if (p != null && p.X <= _pointBottomRight.X)
_curvePoints.Add(new PointF(p.X, p.Y));
g.DrawCurve(_serLinePen, _curvePoints.ToArray());
i = _serPoints.Count;
}
break;
case cSeries.eType.Column:
if (!_seriesSorted[k].FillGradient)
g.FillRectangle(_serEllipseBrush, _serPoints[i].X + (columnscount > 1 ? -columnwidth * columnscount / 2 + columnwidth * columnindex : -columnwidth / 2), _serPoints[i].Y, columnwidth, _drawArea.Y - _serPoints[i].Y);
else
g.FillRectangle(_tbrush, _serPoints[i].X + (columnscount > 1 ? -columnwidth * columnscount / 2 + columnwidth * columnindex : -columnwidth / 2), _serPoints[i].Y, columnwidth, _drawArea.Y - _serPoints[i].Y);
if (_seriesSorted[k].Outline)
g.DrawRectangle(_serLinePen, _serPoints[i].X + (columnscount > 1 ? -columnwidth * columnscount / 2 + columnwidth * columnindex : -columnwidth / 2), _serPoints[i].Y, columnwidth, _drawArea.Y - _serPoints[i].Y);
//g.DrawString(_serPoints[i].Data, xAxis[axisIndex].CategoriesFont, Brushes.DarkGray, _serPoints[i].X, _serPoints[i].Y);
break;
case cSeries.eType.Area:
//if (i == 0)
// g.FillEllipse(_serEllipseBrush, _serPoints[i].X - 4 / _catSkipFactor[axisIndex], _serPoints[i].Y - 4 / _catSkipFactor[axisIndex], 8 / _catSkipFactor[axisIndex], 8 / _catSkipFactor[axisIndex]);
if (i + 1 < _serPoints.Count && _serPoints[i + 1] != null && i < _catsToCount)
{
if (_serPoints[i + 1].X > _pointBottomRight.X)
continue; // dunno.
List<PointF> _areaPoints = new List<PointF>();
_areaPoints.Add(new PointF(_serPoints[i].X, _serPoints[i].Y));
_areaPoints.Add(new PointF(_serPoints[i + 1].X, _serPoints[i + 1].Y));
_areaPoints.Add(new PointF(_serPoints[i + 1].X, _drawArea.Y));
_areaPoints.Add(new PointF(_serPoints[i].X, _drawArea.Y));
if (!_seriesSorted[k].FillGradient)
g.FillPolygon(_areaBrush, _areaPoints.ToArray());
else
g.FillPolygon(_tbrush, _areaPoints.ToArray());
if (_seriesSorted[k].Outline)
g.DrawLine(_serLinePen, _serPoints[i].X, _serPoints[i].Y, _serPoints[i + 1].X, _serPoints[i + 1].Y);
}
//else
// g.FillEllipse(_serEllipseBrush, _serPoints[i].X - 4 / _catSkipFactor[axisIndex], _serPoints[i].Y - 4 / _catSkipFactor[axisIndex], 8 / _catSkipFactor[axisIndex], 8 / _catSkipFactor[axisIndex]);
break;
case cSeries.eType.AreaSolid:
if (i + 1 < _serPoints.Count && _serPoints[i + 1] != null && i < _catsToCount)
{
if (_serPoints[i + 1].X > _pointBottomRight.X)
continue; // dunno.
float half_dis = (_serPoints[i + 1].X - _serPoints[i].X) / 2;
List<PointF> _areaPoints = new List<PointF>();
_areaPoints.Add(new PointF(_serPoints[i].X - (i == 0 ? half_dis : 0), _serPoints[i].Y));
_areaPoints.Add(new PointF(_serPoints[i].X + half_dis, _serPoints[i].Y));
_areaPoints.Add(new PointF(_serPoints[i].X + half_dis, _serPoints[i + 1].Y));
_areaPoints.Add(new PointF(_serPoints[i + 1].X + (i + 2 == _serPoints.Count ? half_dis : 0) + .05f, _serPoints[i + 1].Y));
_areaPoints.Add(new PointF(_serPoints[i + 1].X + (i + 2 == _serPoints.Count ? half_dis : 0) + .05f, _drawArea.Y));
_areaPoints.Add(new PointF(_serPoints[i].X - (i == 0 ? half_dis : 0), _drawArea.Y));
if (!_seriesSorted[k].FillGradient)
g.FillPolygon(_areaBrush, _areaPoints.ToArray());
else
g.FillPolygon(_tbrush, _areaPoints.ToArray());
if (_seriesSorted[k].Outline)
{
g.DrawLine(_serLinePen, _serPoints[i].X - (i == 0 ? half_dis : 0), _serPoints[i].Y, _serPoints[i].X + half_dis, _serPoints[i].Y);
g.DrawLine(_serLinePen, _serPoints[i].X + half_dis, _serPoints[i].Y, _serPoints[i].X + half_dis, _serPoints[i + 1].Y);
g.DrawLine(_serLinePen, _serPoints[i].X + half_dis, _serPoints[i + 1].Y, _serPoints[i + 1].X + (i + 2 == _serPoints.Count ? half_dis : 0), _serPoints[i + 1].Y);
}
}
break;
case cSeries.eType.AreaSpline:
{
List<PointF> _curvePoints = new List<PointF>();
foreach (var p in _serPoints)
if (p != null && p.X <= _pointBottomRight.X)
_curvePoints.Add(new PointF(p.X, p.Y));
i = _serPoints.Count;
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddCurve(_curvePoints.ToArray());
if (_curvePoints.Count > 0)
{
PointF firstPoint = new PointF(_curvePoints[0].X, _curvePoints[0].Y);
PointF lastPoint = new PointF(_curvePoints[_curvePoints.Count - 1].X, _curvePoints[_curvePoints.Count - 1].Y);
path.AddLine(lastPoint.X, lastPoint.Y, lastPoint.X, _drawArea.Y);
path.AddLine(lastPoint.X, _drawArea.Y, firstPoint.X, _drawArea.Y);
path.AddLine(firstPoint.X, _drawArea.Y, firstPoint.X, firstPoint.Y);
if (!_seriesSorted[k].FillGradient)
g.FillPath(_areaBrush, path);
else
g.FillPath(_tbrush, path);
if (_seriesSorted[k].Outline)
g.DrawCurve(_serLinePen, _curvePoints.ToArray());
//g.DrawLine(_serLinePen, lastPoint.X, lastPoint.Y, lastPoint.X, _plotLowerPoint.Y);
//g.DrawLine(_serLinePen, firstPoint.X, _plotLowerPoint.Y, firstPoint.X, firstPoint.Y);
}
}
break;
}
}
}
if (_seriesSorted[k].Type == cSeries.eType.Column)
columnindex++;
}
}
}