本文整理汇总了C#中System.Drawing.Drawing2D.GraphicsPath.AddBeziers方法的典型用法代码示例。如果您正苦于以下问题:C# System.Drawing.Drawing2D.GraphicsPath.AddBeziers方法的具体用法?C# System.Drawing.Drawing2D.GraphicsPath.AddBeziers怎么用?C# System.Drawing.Drawing2D.GraphicsPath.AddBeziers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Drawing2D.GraphicsPath
的用法示例。
在下文中一共展示了System.Drawing.Drawing2D.GraphicsPath.AddBeziers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Paint
/// <summary>
/// Repaints the form with cool background and stuff
/// </summary>
/// <param name="graph">The graphics object to paint to, the element will be drawn to 0,0</param>
override public void Paint(Graphics graph)
{
//Draws Rectangular Shapes
if (Shape == ModelShapes.Arrow)
{
_arrowPath = new System.Drawing.Drawing2D.GraphicsPath();
//Draws the basic shape
Pen arrowPen;
if (Highlight < 1)
arrowPen = new Pen(Color.Cyan, 3F);
else
arrowPen = new Pen(Color.Black, 3F);
//Draws the curved arrow
Point[] lineArray = new Point[4];
lineArray[0] = new Point(_startPoint.X, _startPoint.Y);
lineArray[1] = new Point(_startPoint.X - ((_startPoint.X - _stopPoint.X) / 3), _startPoint.Y);
lineArray[2] = new Point(_stopPoint.X - ((_stopPoint.X - _startPoint.X) / 3), _stopPoint.Y);
lineArray[3] = new Point(_stopPoint.X, _stopPoint.Y);
graph.DrawBeziers(arrowPen, lineArray);
_arrowPath.AddBeziers(lineArray);
_arrowPath.Flatten();
//Draws the arrow head
Point[] arrowArray = new Point[3];
arrowArray[0] = _stopPoint;
arrowArray[1] = new Point(_stopPoint.X - (5 * Math.Sign(_stopPoint.X - _startPoint.X)),_stopPoint.Y - 2);
arrowArray[2] = new Point(_stopPoint.X - (5 * Math.Sign(_stopPoint.X - _startPoint.X)), _stopPoint.Y + 2);
graph.DrawPolygon(arrowPen,arrowArray);
//Garbage collection
arrowPen.Dispose();
}
}