当前位置: 首页>>代码示例>>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;未经允许,请勿转载。