當前位置: 首頁>>代碼示例>>C#>>正文


C# GraphicsPath.AddClosedCurve方法代碼示例

本文整理匯總了C#中System.Drawing.Drawing2D.GraphicsPath.AddClosedCurve方法的典型用法代碼示例。如果您正苦於以下問題:C# GraphicsPath.AddClosedCurve方法的具體用法?C# GraphicsPath.AddClosedCurve怎麽用?C# GraphicsPath.AddClosedCurve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.Drawing2D.GraphicsPath的用法示例。


在下文中一共展示了GraphicsPath.AddClosedCurve方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ReturnBounds

        public override RectangleF ReturnBounds()
        {
            Point[] points = (Point[])pointsList.ToArray(typeof(Point));
            GraphicsPath path = new GraphicsPath();
            path.AddClosedCurve(points, 1);

            path.Transform(this.TMatrix.TransformationMatrix);
            return path.GetBounds();
        }
開發者ID:ferry2,項目名稱:2D-Vector-Graphics,代碼行數:9,代碼來源:ClosedCurveShape.cs

示例2: UpdatePath

        protected override void UpdatePath()
        {
            if (this.Points == null || this.Points.Length == 0) return;

            InternalPath = new GraphicsPath();
            InternalPath.AddClosedCurve(this.Points);

            Matrix mtx = new Matrix();
            mtx.RotateAt(this.Rotation, InternalRotationBasePoint);
            InternalPath.Transform(mtx);
        }
開發者ID:westybsa,項目名稱:MP.LSharp,代碼行數:11,代碼來源:ShapeClosedCurve.cs

示例3: Type

 private void Type(Control sender, int p_1, double p_2)
 {
     GraphicsPath oPath = new GraphicsPath();
     oPath.AddClosedCurve(new Point[] { new Point(0, sender.Height / p_1),
         new Point(sender.Width / p_1, 0),
         new Point(sender.Width - sender.Width / p_1, 0), 
         new Point(sender.Width, sender.Height / p_1), 
         new Point(sender.Width, sender.Height - sender.Height / p_1),
         new Point(sender.Width - sender.Width / p_1, sender.Height),
         new Point(sender.Width / p_1, sender.Height),
         new Point(0, sender.Height - sender.Height / p_1) }, (float)p_2);
     sender.Region = new Region(oPath);
 }
開發者ID:changchengxu,項目名稱:soc_remote_csharp,代碼行數:13,代碼來源:gf_remote.cs

示例4: DrawYourSelf

        public override void DrawYourSelf(Graphics graphics)
        {
            if (pointsList.Count < 4) return;
            Point[] points = (Point[])pointsList.ToArray(typeof(Point));

            GraphicsPath path = new GraphicsPath();
            path.AddClosedCurve(points, 1);
            path.Transform(this.TMatrix.TransformationMatrix);

            Pen pen = new Pen(this.BorderColor, this.BorderWidth);
            if (IS_FILLED)
            {
                SolidBrush brush = new SolidBrush(this.FillColor);
                graphics.FillPath(brush, path);
            }
            graphics.DrawPath(pen, path);

            if (this.Selected)
            {
                this.selectionUnit = new CoveringRectangle(Rectangle.Round(ReturnBounds()));
                this.selectionUnit.DrawYourSelf(graphics);
            }
        }
開發者ID:ferry2,項目名稱:2D-Vector-Graphics,代碼行數:23,代碼來源:ClosedCurveShape.cs

示例5: ClosedCurve

		static private GraphicsPath ClosedCurve ()
		{
			GraphicsPath path = new GraphicsPath ();
			path.AddClosedCurve (new Point[4] { 
				new Point (20, 100), new Point (70, 10),
				new Point (130, 200), new Point (180, 100)
				});
			return path;
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:9,代碼來源:Shapes.cs

示例6: AddClosedCurve_PointFArr

		public void AddClosedCurve_PointFArr()
		{
			PointF [] points = new PointF [] {	new PointF(20.01f, 100.1f),
												new PointF(40.02f, 75.2f),
												new PointF(60.03f, 125.3f),
												new PointF(80.04f, 100.4f),
												new PointF(100.05f, 50.5f),
												new PointF(120.06f, 150.6f),
												new PointF(140.07f, 100.7f)};

			path = new GraphicsPath();
			path.AddClosedCurve(points);

			Assert.AreEqual (22, path.PointCount);

			PointF [] expectedPoints = new PointF [] {	new PointF(20.01f, 100.1f), 
														new PointF(3.334998f, 95.84999f), 
														new PointF(33.35f, 70.99999f), 
														new PointF(40.02f, 75.2f), 
														new PointF(46.69f, 79.39999f), 
														new PointF(53.36f, 121.1f), 
														new PointF(60.03f, 125.3f), 
														new PointF(66.7f, 129.5f), 
														new PointF(73.37f, 112.8667f), 
														new PointF(80.04f, 100.4f), 
														new PointF(86.71f, 87.93333f), 
														new PointF(93.38f, 42.13333f), 
														new PointF(100.05f, 50.5f), 
														new PointF(106.72f, 58.86666f), 
														new PointF(113.39f, 142.2333f), 
														new PointF(120.06f, 150.6f), 
														new PointF(126.73f, 158.9667f), 
														new PointF(156.745f, 109.1167f), 
														new PointF(140.07f, 100.7f), 
														new PointF(123.395f, 92.28333f), 
														new PointF(36.685f, 104.35f), 
														new PointF(20.01f, 100.1f)};
			
			for(int i = 0; i < path.PointCount; i++) {
				DrawingTest.AssertAlmostEqual(expectedPoints [i], path.PathPoints [i]);
			}

			byte [] expectedTypes = new byte [] {	(byte) PathPointType.Start, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) PathPointType.Bezier3, 
													(byte) (PathPointType.Bezier | PathPointType.CloseSubpath)};

			for (int i=0; i < expectedTypes.Length; i++) {
				Assert.AreEqual (expectedTypes [i], path.PathTypes [i]);
			}	

			t.Graphics.DrawPath (p, path);
			t.Show ();
			//t.AssertCompare ();
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:73,代碼來源:GraphicsPath.cs

示例7: AddClosedCurve1

        private void AddClosedCurve1(Graphics g)
        {
            // Creates a symetrical, closed curve.
            Point[] myArray =
            {
                new Point(20,100),
                new Point(40,150),
                new Point(60,125),
                new Point(40,100),
                new Point(60,75),
                new Point(40,50)
            };

            // Create a new path and add curve.
            GraphicsPath myPath = new GraphicsPath();
            myPath.AddClosedCurve(myArray, 0.5f);
            Pen myPen = new Pen(Color.Black, 2);

            // Draw the path to screen.
            g.DrawPath(myPen, myPath);
        }
開發者ID:mono,項目名稱:sysdrawing-coregraphics,代碼行數:21,代碼來源:DrawingView.cs

示例8: GetBounds_Empty_ClosedCurve

		public void GetBounds_Empty_ClosedCurve ()
		{
			GraphicsPath gp = new GraphicsPath ();
			gp.AddClosedCurve (new Point[4] { new Point (20, 100), new Point (70, 10),
				new Point (130, 200), new Point (180, 100) });
#if false
			// so far from reality that it's totally useless
			Assert.AreEqual (1.666666f, rect.X, 0.00001, "Bounds.X");
			Assert.AreEqual (-6.66666f, rect.Y, 1, "Bounds.Y");
			Assert.AreEqual (196.6666f, rect.Width, 1, "Bounds.Width");
			Assert.AreEqual (221.6666f, rect.Height, 1, "Bounds.Height");
#endif
			gp.Dispose ();
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:14,代碼來源:GraphicsPathTest.cs

示例9: StartClose_AddClosedCurve

		public void StartClose_AddClosedCurve ()
		{
			GraphicsPath path = new GraphicsPath ();
			path.AddLine (1, 1, 2, 2);
			path.AddClosedCurve (new Point[3] { new Point (1, 1), new Point (2, 2), new Point (3, 3) });
			path.AddLine (10, 10, 20, 20);
			byte[] types = path.PathTypes;
			// check first types
			Assert.AreEqual (0, types[0], "start/Line");
			Assert.AreEqual (0, types[2], "start/ClosedCurve");
			// check last types
			Assert.AreEqual (131, types[path.PointCount - 3], "end/ClosedCurve");
			Assert.AreEqual (0, types[path.PointCount - 2], "start/Line3");
			Assert.AreEqual (1, types[path.PointCount - 1], "end/Line3");
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:15,代碼來源:GraphicsPathTest.cs

示例10: AddClosedCurve_PointF_1

		public void AddClosedCurve_PointF_1 ()
		{
			GraphicsPath gp = new GraphicsPath ();
			gp.AddClosedCurve (new PointF[1] { new PointF (1f, 1f) });
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:5,代碼來源:GraphicsPathTest.cs

示例11: AddClosedCurve_PointF_3

		public void AddClosedCurve_PointF_3 ()
		{
			GraphicsPath gp = new GraphicsPath ();
			gp.AddClosedCurve (new PointF[3] { new PointF (1f, 1f), new PointF (2f, 2f), new PointF (3f, 3f) });
			CheckClosedCurve (gp);
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:6,代碼來源:GraphicsPathTest.cs

示例12: AddClosedCurve_Point_1

		public void AddClosedCurve_Point_1 ()
		{
			GraphicsPath gp = new GraphicsPath ();
			gp.AddClosedCurve (new Point[1] { new Point (1, 1) });
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:5,代碼來源:GraphicsPathTest.cs

示例13: AddClosedCurve_Point_3

		public void AddClosedCurve_Point_3 ()
		{
			GraphicsPath gp = new GraphicsPath ();
			gp.AddClosedCurve (new Point[3] { new Point (1, 1), new Point (2, 2), new Point (3, 3) });
			CheckClosedCurve (gp);
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:6,代碼來源:GraphicsPathTest.cs

示例14: HitTest

		/// <summary>
		/// Performs a hit test on the <see cref="Graphic"/> at a given point.
		/// </summary>
		/// <param name="point">The mouse position in destination coordinates.</param>
		/// <returns>
		/// <b>True</b> if <paramref name="point"/> "hits" the <see cref="Graphic"/>,
		/// <b>false</b> otherwise.
		/// </returns>
		public override bool HitTest(Point point)
		{
			base.CoordinateSystem = CoordinateSystem.Destination;
			try
			{
				using (var gp = new GraphicsPath())
				using (var pen = new Pen(Color.Black, HitTestDistance))
				{
					PointF[] pathPoints = GetCurvePoints(_points);
					if (_points.IsClosed)
						gp.AddClosedCurve(pathPoints);
					else
						gp.AddCurve(pathPoints);
					return gp.IsOutlineVisible(point, pen);
				}
			}
			finally
			{
				base.ResetCoordinateSystem();
			}
		}
開發者ID:m-berkani,項目名稱:ClearCanvas,代碼行數:29,代碼來源:SplinePrimitive.cs

示例15: GetGrips

			public override IGripManipulationHandle[] GetGrips(double pageScale, int gripLevel)
			{
				if (gripLevel <= 1)
				{
					ClosedCardinalSpline ls = (ClosedCardinalSpline)_hitobject;
					PointF[] pts = new PointF[ls._curvePoints.Count];
					var offset = ls.Location.AbsoluteVectorPivotToLeftUpper;
					for (int i = 0; i < pts.Length; i++)
					{
						pts[i] = (PointF)(ls._curvePoints[i] + offset);
						var pt = ls._transformation.TransformPoint(pts[i]);
						pt = this.Transformation.TransformPoint(pt);
						pts[i] = pt;
					}

					IGripManipulationHandle[] grips = new IGripManipulationHandle[gripLevel == 0 ? 1 : 1 + ls._curvePoints.Count];

					// Translation grips
					GraphicsPath path = new GraphicsPath();
					path.AddClosedCurve(pts, (float)ls._tension);
					path.Widen(new Pen(Color.Black, (float)(6 / pageScale)));
					grips[grips.Length - 1] = new MovementGripHandle(this, path, null);

					// PathNode grips
					if (gripLevel == 1)
					{
						float gripRadius = (float)(3 / pageScale);
						for (int i = 0; i < ls._curvePoints.Count; i++)
						{
							grips[i] = new ClosedCardinalSplinePathNodeGripHandle(this, i, pts[i], gripRadius);
						}
					}
					return grips;
				}
				else
				{
					return base.GetGrips(pageScale, gripLevel);
				}
			}
開發者ID:Altaxo,項目名稱:Altaxo,代碼行數:39,代碼來源:ClosedCardinalSpline.cs


注:本文中的System.Drawing.Drawing2D.GraphicsPath.AddClosedCurve方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。