Esempio n. 1
0
		/// <summary>
		/// Resets the specified GraphicsPath object an adds a line to it.
		/// </summary>
		/// <param name="linePath">The GraphicsPath object to reset.</param>
		/// <param name="newLinePath">The line to add.</param>
		public static void SetLine(System.Drawing.Drawing2D.GraphicsPath linePath, System.Drawing.Drawing2D.GraphicsPath newLinePath)
		{
			linePath.Reset();
			linePath.AddPath(newLinePath, false);
		}
Esempio n. 2
0
	/*******************************/
	/// <summary>
	/// Adds the X and Y coordinates to the current graphics path.
	/// </summary>
	/// <param name="graphPath"> The current Graphics path</param>
	/// <param name="xCoordinate">The x coordinate to be added</param>
	/// <param name="yCoordinate">The y coordinate to be added</param>
	public static void AddPointToGraphicsPath(System.Drawing.Drawing2D.GraphicsPath graphPath, int x, int y)
	{
		System.Drawing.PointF[] tempPointArray = new System.Drawing.PointF[graphPath.PointCount + 1];
		byte[] tempPointTypeArray = new byte[graphPath.PointCount + 1];

		if (graphPath.PointCount == 0)
		{
			tempPointArray[0] = new System.Drawing.PointF(x, y);		
			System.Drawing.Drawing2D.GraphicsPath tempGraphicsPath = new System.Drawing.Drawing2D.GraphicsPath(tempPointArray, new byte[]{(byte)System.Drawing.Drawing2D.PathPointType.Start});
			graphPath.AddPath(tempGraphicsPath, false);
		}
		else
		{
			graphPath.PathPoints.CopyTo(tempPointArray, 0);
			tempPointArray[graphPath.PointCount] = new System.Drawing.Point(x, y);
			
			graphPath.PathTypes.CopyTo(tempPointTypeArray, 0);
			tempPointTypeArray[graphPath.PointCount] = (byte) System.Drawing.Drawing2D.PathPointType.Line;

			System.Drawing.Drawing2D.GraphicsPath tempGraphics = new System.Drawing.Drawing2D.GraphicsPath(tempPointArray, tempPointTypeArray);
			graphPath.Reset();
			graphPath.AddPath(tempGraphics, false);
			graphPath.CloseFigure();
		}
	}