当前位置: 首页>>代码示例>>C#>>正文


C# GraphicsPath.Reverse方法代码示例

本文整理汇总了C#中System.Drawing.Drawing2D.GraphicsPath.Reverse方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsPath.Reverse方法的具体用法?C# GraphicsPath.Reverse怎么用?C# GraphicsPath.Reverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Drawing2D.GraphicsPath的用法示例。


在下文中一共展示了GraphicsPath.Reverse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ArcRenderRange

        private static void ArcRenderRange(this Graphics Graphics, Rectangle ClientRectangle, Point Center, Int32 ArcStart, Int32 ArcSweep, Single MinimumValue, Single MaximumValue, ArcRangeDef Range)
        {
            Graphics.SetClip(ClientRectangle);
            Graphics.SmoothingMode = SmoothingMode.HighQuality;
            Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;

            using (var graphicsPath = new GraphicsPath()) {
                if (Range.EndValue > Range.StartValue && Range.Enabled) {
                    var rangeStartAngle = ArcStart + (Range.StartValue - MinimumValue) * ArcSweep / (MaximumValue - MinimumValue);
                    var rangeSweepAngle = (Range.EndValue - Range.StartValue) * ArcSweep / (MaximumValue - MinimumValue);
                    graphicsPath.Reset();
                    graphicsPath.AddPie(new Rectangle(Center.X - Range.OuterRadius, Center.Y - Range.OuterRadius, 2 * Range.OuterRadius, 2 * Range.OuterRadius), rangeStartAngle, rangeSweepAngle);
                    graphicsPath.Reverse();
                    graphicsPath.AddPie(new Rectangle(Center.X - Range.InnerRadius, Center.Y - Range.InnerRadius, 2 * Range.InnerRadius, 2 * Range.InnerRadius), rangeStartAngle, rangeSweepAngle);
                    graphicsPath.Reverse();
                    Graphics.SetClip(graphicsPath);
                    using (var solidBrush = new SolidBrush(Range.ForeColor)) {
                        Graphics.FillPie(solidBrush, new Rectangle(Center.X - Range.OuterRadius, Center.Y - Range.OuterRadius, 2 * Range.OuterRadius, 2 * Range.OuterRadius), rangeStartAngle, rangeSweepAngle);
                    }
                }
            }
        }
开发者ID:StewartScottRogers,项目名称:RealtimeControlsSolution,代码行数:22,代码来源:ArcRangeRenderer.cs

示例2: Reverse_Subpath_Marker_2

		public void Reverse_Subpath_Marker_2 ()
		{
			using (GraphicsPath gp = new GraphicsPath ()) {
				gp.AddLine (0, 1, 2, 3);
				gp.SetMarkers ();
				gp.StartFigure ();
				gp.AddLine (20, 21, 22, 23);
				gp.AddBezier (5, 6, 7, 8, 9, 10, 11, 12);
				PointF[] bp = gp.PathPoints;
				byte[] expected = new byte[] { 0, 3, 3, 3, 1, 33, 0, 1 };

				gp.Reverse ();
				PointF[] ap = gp.PathPoints;
				byte[] at = gp.PathTypes;

				int count = gp.PointCount;
				Assert.AreEqual (bp.Length, count, "PointCount");
				for (int i = 0; i < count; i++) {
					Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
					Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
				}
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:23,代码来源:GraphicsPathTest.cs

示例3: Reverse_Marker

		public void Reverse_Marker ()
		{
			using (GraphicsPath gp = new GraphicsPath ()) {
				gp.AddRectangle (new Rectangle (200, 201, 60, 61));
				gp.SetMarkers ();
				PointF[] bp = gp.PathPoints;
				byte[] expected = new byte[] { 0, 1, 1, 129 };

				gp.Reverse ();
				PointF[] ap = gp.PathPoints;
				byte[] at = gp.PathTypes;

				int count = gp.PointCount;
				Assert.AreEqual (bp.Length, count, "PointCount");
				for (int i = 0; i < count; i++) {
					Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
					Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
				}
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:20,代码来源:GraphicsPathTest.cs

示例4: Reverse_String

		[Category ("NotWorking")] // the output differs from GDI+ and libgdiplus
		public void Reverse_String ()
		{
			using (GraphicsPath gp = new GraphicsPath ()) {
				FontFamily ff = GetFontFamily ();
				gp.AddString ("Mono::", ff, 0, 10, new Point (10, 10), StringFormat.GenericDefault);
				PointF[] bp = gp.PathPoints;
				byte[] expected = new byte[] { 0,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,129,0,3,3,3,
					3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,161,0,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,
					3,3,3,3,3,3,3,129,0,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,161,0,3,3,3,3,3,
					3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,131,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
					163,0,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,
					1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,
					3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,161,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,131,
					0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,163,0,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,
					3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,
					1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,129 };

				gp.Reverse ();
				PointF[] ap = gp.PathPoints;
				byte[] at = gp.PathTypes;

				int count = gp.PointCount;
				Assert.AreEqual (bp.Length, count, "PointCount");
				for (int i = 0; i < count; i++) {
					Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
					Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
				}
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:30,代码来源:GraphicsPathTest.cs

示例5: Reverse_Path

		public void Reverse_Path ()
		{
			using (GraphicsPath gp = new GraphicsPath ()) {
				GraphicsPath path = new GraphicsPath ();
				path.AddArc (1f, 1f, 2f, 2f, Pi4, Pi4);
				path.AddLine (1, 2, 3, 4);
				gp.AddPath (path, true);
				PointF[] bp = gp.PathPoints;
				byte[] expected = new byte[] { 0, 1, 1, 3, 3, 3 };

				gp.Reverse ();
				PointF[] ap = gp.PathPoints;
				byte[] at = gp.PathTypes;

				int count = gp.PointCount;
				Assert.AreEqual (bp.Length, count, "PointCount");
				for (int i = 0; i < count; i++) {
					Assert.AreEqual (bp[i], ap[count - i - 1], "Point" + i.ToString ());
					Assert.AreEqual (expected[i], at[i], "Type" + i.ToString ());
				}
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:22,代码来源:GraphicsPathTest.cs

示例6: GetRoundedPath1

        private GraphicsPath GetRoundedPath1(Rectangle rect, Rectangle rectPrev, Rectangle rectNext, ref GraphicsPath path4Fill, int charW)
        {
            int r = RoundedCornersRadius; int d = r * 2;
            Rectangle arc = new Rectangle(rect.Location, new Size(d, d));
            GraphicsPath path4Bord = new GraphicsPath();
            if (d > rect.Height) {
                d = rect.Height; r = rect.Height / 2;
                arc.Width  = d;
                arc.Height = d;
            }

            if (rectNext.Width >0 && rect.Left > rectNext.Left) {
                arc.X = rect.Left - d;
                arc.Y = rect.Bottom - d;
                var p = new GraphicsPath();
                p.AddArc(arc, 0, 90);
                p.Reverse();
                path4Bord.AddPath(p, true);
                var p2 = new GraphicsPath();
                p2.AddArc(arc, 0, 90);
                p2.Reverse();
                path4Fill.AddPath(p2, true);
            }

            Point pLeftBottom = new Point(rect.Left, rect.Bottom - r);
            Point pLeftTop    = new Point(rect.Left, rect.Top    + r);

            if (rectNext.Width!=0 && rectNext.Left == rect.Left)
                pLeftBottom = new Point(rect.Left, rect.Bottom);

            if (rectPrev.Width!=0 && rectPrev.Left == rect.Left)
                pLeftTop    = new Point(rect.Left, rect.Top   );

            path4Bord.AddLine(pLeftBottom, pLeftTop);
            path4Fill.AddLine(new Point(pLeftBottom.X, pLeftBottom.Y), pLeftTop);
            if (rectPrev.IsEmpty) {
                // This is first line
                arc.X = rect.Left;
                arc.Y = rect.Top;
                path4Bord.AddArc(arc, 180, 90);
                path4Fill.AddArc(arc, 180, 90);
                arc.X = rect.Right - d;
                path4Bord.AddArc(arc, 270, 90);
                path4Fill.AddArc(arc, 270, 90);
                NextLinePath(ref path4Bord, ref path4Fill, rect, rectNext, arc, d, charW);
            } else {
                // This is no first line
                if (rect.Left < rectPrev.Left) {
                    path4Bord.AddArc(arc, 180, 90);
                    path4Fill.AddArc(arc, 180, 90);
                    path4Bord.StartFigure();
                    path4Bord.AddLine(rect.Left + r, rect.Top, rectPrev.Left - r, rect.Top);
                    path4Fill.AddLine(rect.Left + r, rect.Top, rectPrev.Left - r, rect.Top);
                }
                if (rect.Right > rectPrev.Right) {
                    int a = 0;
                    if (d > (rect.Right - rectPrev.Right)) {
                        a = d;
                        d = charW; r = charW / 2;
                        arc.Width  = d;
                        arc.Height = d;
                    }
                    path4Bord.StartFigure();
                    path4Bord.AddLine(rectPrev.Right + r, rect.Top, rect.Right - r, rect.Top);
                    path4Fill.AddLine(rectPrev.Right + r, rect.Top, rect.Right - r, rect.Top);
                    arc.X = rect.Right - d;
                    arc.Y = rect.Top;
                    path4Bord.AddArc(arc, 270, 90);
                    path4Fill.AddArc(arc, 270, 90);
                    if (a > 0) {
                        d = a; r = d / 2;
                        arc.Width  = d;
                        arc.Height = d;
                        arc.X = rect.Right - d;
                        arc.Y = rect.Top;
                    }
                    NextLinePath(ref path4Bord, ref path4Fill, rect, rectNext, arc, d, charW);
                } else if (rect.Right < rectPrev.Right) {
                    int a = 0;
                    if (d > (rectPrev.Right - rect.Right)) {
                        a = d;
                        d = charW; r = charW / 2;
                        arc.Width  = d;
                        arc.Height = d;
                    }
                    path4Bord.StartFigure();
                    arc.Y = rect.Top;
                    arc.X = rect.Right;
                    var p = new GraphicsPath();
                    p.AddArc(arc, 180, 90);
                    p.Reverse();
                    path4Bord.AddPath(p, false);
                    path4Fill.AddPath(p, true);
                    if (a > 0) {
                        d = a; r = d / 2;
                        arc.Width  = d;
                        arc.Height = d;
                    }
                    path4Bord.AddLine(rect.Right, rect.Top + r, rect.Right, rect.Bottom - r);
                    path4Fill.AddLine(rect.Right, rect.Top + r, rect.Right, rect.Bottom - r);
//.........这里部分代码省略.........
开发者ID:WendyH,项目名称:HMSEditor_addon,代码行数:101,代码来源:Style.cs

示例7: RenderLines

 public void RenderLines(RequestedTileInformation ti, Graphics g, Way way, RenderInfo ri)
 {
     if (way.WayDataBlocks != null && way.WayDataBlocks.Count > 0)
     {
         bool nDone = false;
         float f = getPaintZoomLevel(ti.Zoom);
         foreach (Way.WayData wd in way.WayDataBlocks)
         {
             System.Drawing.PointF[] pa = (from p in wd.DataBlock[0].CoordBlock select new System.Drawing.PointF((float)toRelTileX(p.Longitude, ti.X, ti.Zoom), (float)toRelTileY(p.Latitude, ti.Y, ti.Zoom))).ToArray();
             using (GraphicsPath gp = new GraphicsPath())
             {
                 for (int i = 0; i < pa.Length - 1; i++)
                 {
                     gp.AddLine(pa[i], pa[i + 1]);
                 }
                 Pen p = ri.Pen ?? new Pen(Color.Black);
                 p.Width = ri.fstroke_width * f;
                 g.DrawPath(p, gp);
                 if (ri.FillPen != null)
                 {
                     ri.FillPen.Width = ri.fstroke_width * f * 0.8f;
                     g.DrawPath(ri.FillPen, gp);
                 }
                 if (!string.IsNullOrEmpty(way.Name) && p.Width > 6.0f && !nDone)
                 {
                     nDone = true; //only once per tile is enough I think
                     using (Font fnt = new Font(FontFamily.GenericSerif, p.Width))
                     {
                         //determine angle of polyline (use start and endpoint?)
                         //if wrong (text upside down), then reverse polyline
                         PointF p1 = pa[0];
                         PointF p2 = pa[pa.Length - 1];
                         if (p1.X > p2.X)
                         {
                             gp.Reverse();
                         }
                         g.DrawString(way.Name, fnt, _fixedTextBrush, TextPathAlign.Center, TextPathPosition.CenterPath, 100, 0, gp);
                     }
                 }
             }
         }
     }
 }
开发者ID:GlobalcachingEU,项目名称:GSAKWrapper,代码行数:43,代码来源:ItemRenderer.cs

示例8: ImageBack1

            //画刻度
            private void ImageBack1(GraphicsPath gp, Graphics ggr, ImagePaint imgp)
            {
                for (var counter = 0; counter < mRangeEndValue.Length; counter++)
                {
                    if (!(mRangeEndValue[counter] > mRangeStartValue[counter]) || !mRangeEnabled[counter])
                    {
                        continue;
                    }

                    var rangeStartAngle = mBaseArcStart +(mRangeStartValue[counter] - mMinValue) * mBaseArcSweep /(mMaxValue - mMinValue);
                    var rangeSweepAngle = (mRangeEndValue[counter] - mRangeStartValue[counter]) * mBaseArcSweep / (mMaxValue - mMinValue);
                    gp.Reset();
                    gp.AddPie(
                        new Rectangle(mCenter.X - mRangeOuterRadius[counter],
                                      mCenter.Y - mRangeOuterRadius[counter], 2 * mRangeOuterRadius[counter],
                                      2 * mRangeOuterRadius[counter]), rangeStartAngle, rangeSweepAngle);
                    gp.Reverse();
                    gp.AddPie(
                        new Rectangle(mCenter.X - mRangeInnerRadius[counter],
                                      mCenter.Y - mRangeInnerRadius[counter], 2 * mRangeInnerRadius[counter],
                                      2 * mRangeInnerRadius[counter]), rangeStartAngle, rangeSweepAngle);
                    gp.Reverse();
                    ggr.SetClip(gp);
                    //填充
                    ggr.FillPie(new SolidBrush(mRangeColor[counter]),
                                new Rectangle(mCenter.X - mRangeOuterRadius[counter],
                                              mCenter.Y - mRangeOuterRadius[counter],
                                              2 * mRangeOuterRadius[counter], 2 * mRangeOuterRadius[counter]),
                                rangeStartAngle, rangeSweepAngle);
                }
                ggr.SetClip(imgp.ClientRectangle);

                if (mBaseArcRadius > 0)
                {
                    ggr.DrawArc(new Pen(mBaseArcColor, mBaseArcWidth),
                                new Rectangle(mCenter.X - mBaseArcRadius, mCenter.Y - mBaseArcRadius,
                                              2 * mBaseArcRadius, 2 * mBaseArcRadius), mBaseArcStart, mBaseArcSweep);
                }
            }
开发者ID:GankerChen2012,项目名称:PdfTools,代码行数:40,代码来源:YiBiao.cs

示例9: Enumerate

        public virtual void Enumerate() 
		{
            GraphicsPath path = new GraphicsPath ();
			path.AddLine (new Point (100, 100), new Point (400, 100));
			path.AddLine (new Point (400, 200), new Point (10, 100));

			path.StartFigure ();
			path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);
			path.StartFigure ();
			path.AddRectangle (new Rectangle (10, 20, 300, 400));

			path.StartFigure ();
			path.AddLine (new Point (400, 400), new Point (400, 10));

			path.Reverse ();

			GraphicsPathIterator iterator = new GraphicsPathIterator (path);
			PointF [] actualPoints = new PointF [14];
			byte [] actualTypes = new byte [14];
			iterator.Enumerate (ref actualPoints, ref actualTypes);

			PointF [] expectedPoints = new PointF [] {	new PointF(400f, 10f), 
														new PointF(400f, 400f), 
														new PointF(10f, 420f), 
														new PointF(310f, 420f), 
														new PointF(310f, 20f), 
														new PointF(10f, 20f), 
														new PointF(200f, 280f), 
														new PointF(100f, 5f), 
														new PointF(50f, 250f), 
														new PointF(10f, 10f), 
														new PointF(10f, 100f), 
														new PointF(400f, 200f), 
														new PointF(400f, 100f), 
														new PointF(100f, 100f)};
			
			for(int i = 0; i < expectedPoints.Length; i++) {
				DrawingTest.AssertAlmostEqual(expectedPoints [i], actualPoints [i]);
			}

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

			for (int i=0; i < expectedTypes.Length; i++) {
				Assert.AreEqual (expectedTypes [i], actualTypes [i]);
			}	
        }
开发者ID:nlhepler,项目名称:mono,代码行数:59,代码来源:GraphicsPathIterator.cs

示例10: SetMarkers2

        private void SetMarkers2(Graphics g)
        {
            // Create a path and set two markers.
            GraphicsPath myPath = new GraphicsPath();
            myPath.AddLine(new Point(0, 0), new Point(50, 50));
            myPath.SetMarkers();
            Rectangle rect = new Rectangle(50, 50, 50, 50);
            myPath.AddRectangle(rect);
            myPath.SetMarkers();
            myPath.AddEllipse(100, 100, 100, 50);

            var pathPoints = myPath.PathPoints;
            var pathTypes = myPath.PathTypes;

            Console.WriteLine("SetMarkers Before reverse");
            for (int i = 0; i < myPath.PathTypes.Length; i++)
            {
                Console.WriteLine("{0} - {1},{2}", (PathPointType)pathTypes[i], pathPoints[i].X, pathPoints[i].Y);
            }

            // Draw the path to screen.
            g.FillPath(Brushes.Red, myPath);
            g.DrawPath(new Pen(Color.Black, 2), myPath);

            // Draw the first set of points to the screen.
            DrawPoints2(g, myPath.PathPoints, 20);

            // Call GraphicsPath.Reverse.
            myPath.Reverse();

            pathPoints = myPath.PathPoints;
            pathTypes = myPath.PathTypes;

            Console.WriteLine("SetMarkers After reverse");
            for (int i = 0; i < myPath.PathTypes.Length; i++)
            {
                Console.WriteLine("{0} - {1},{2}", (PathPointType)pathTypes[i], pathPoints[i].X, pathPoints[i].Y);
            }

            // Draw the path to screen.
            g.FillPath(Brushes.CornflowerBlue, myPath);
            g.DrawPath(new Pen(Color.Black, 2), myPath);

            // Draw the reversed set of points to the screen.
            DrawPoints2(g, myPath.PathPoints, 150);
        }
开发者ID:mono,项目名称:sysdrawing-coregraphics,代码行数:46,代码来源:DrawingView.cs

示例11: Reverse1

        // End DrawPoints
        public void Reverse1(Graphics g)
        {
            // Create a path and add a line, ellipse, and arc.
            GraphicsPath myPath = new GraphicsPath(FillMode.Winding);
            myPath.AddLine(new Point(0, 0), new Point(100, 100));
            myPath.AddEllipse(100, 100, 200, 250);
            myPath.AddArc(300, 250, 100, 100, 0, 90);

            g.DrawPath (Pens.Red, myPath);
            g.FillPath (Brushes.Red, myPath);

            var pathPoints = myPath.PathPoints;
            var pathTypes = myPath.PathTypes;

            Console.WriteLine ("Before reverse");
            for(int i=0;i < myPath.PathTypes.Length; i++)
            {
                Console.WriteLine ("{0} - {1},{2}", (PathPointType)pathTypes [i], pathPoints[i].X,pathPoints[i].Y);
            }

            // Draw the first set of points to the screen.
            DrawPoints2(g, myPath.PathPoints, 20);

            // Call GraphicsPath.Reverse.
            myPath.Reverse();

            g.DrawPath (Pens.Blue, myPath);
            g.FillPath (Brushes.Blue, myPath);

            pathPoints = myPath.PathPoints;
            pathTypes = myPath.PathTypes;

            Console.WriteLine ("After reverse");
            for(int i=0;i < myPath.PathTypes.Length; i++)
            {
                Console.WriteLine ("{0} - {1},{2}", (PathPointType)pathTypes [i], pathPoints[i].X,pathPoints[i].Y);
            }

            // Draw the reversed set of points to the screen.
            DrawPoints2(g, myPath.PathPoints, 150);
        }
开发者ID:mono,项目名称:sysdrawing-coregraphics,代码行数:42,代码来源:DrawingView.cs

示例12: EvaluateParameters

        public void EvaluateParameters()
        {
            Rectangle outerRectangle = new Rectangle(
                (int)(_owner.Center.X - _owner.OuterRadius * _outerFactor),
                (int)(_owner.Center.Y - _owner.OuterRadius * _outerFactor),
                (int)(2 * _owner.OuterRadius * _outerFactor),
                (int)(2 * _owner.OuterRadius * _outerFactor)
                );

            Rectangle innerRectangle = new Rectangle(
                (int)(_owner.Center.X - _owner.InnerRadius * _innerFactor),
                (int)(_owner.Center.Y - _owner.InnerRadius * _innerFactor),
                (int)(2 * _owner.InnerRadius * _innerFactor),
                (int)(2 * _owner.InnerRadius * _innerFactor)
                );

            // Внешняя дуга.
            GraphicsPath outerArc = new GraphicsPath();
            outerArc.AddArc(outerRectangle, _startAngle, _sweepAngle);

            // Внутренняя дуга сектора.
            GraphicsPath innerArc = new GraphicsPath();
            innerArc.AddArc(innerRectangle, _startAngle, _sweepAngle);

            // Вычисляем границу сектора.
            _diagSectorPath.Dispose();
            _diagSectorPath = new GraphicsPath();
            _diagSectorPath.AddPath(outerArc, true);
            _diagSectorPath.AddLine(
                outerArc.GetLastPoint(),
                innerArc.GetLastPoint()
                );
            innerArc.Reverse();
            _diagSectorPath.AddPath(innerArc, true);
            outerArc.Reverse();
            _diagSectorPath.AddLine(
                outerArc.GetLastPoint(),
                innerArc.GetLastPoint()
                );

            _region.Dispose();
            _region = new Region(_diagSectorPath);

            _owner.Invalidate();
        }
开发者ID:virl,项目名称:yttrium,代码行数:45,代码来源:PartitionControl.cs

示例13: Reverse2

		public void Reverse2()
		{
			path = new GraphicsPath ();
			path.AddLine (new Point (100, 100), new Point (400, 100));
			path.SetMarkers ();
			path.AddLine (new Point (400, 200), new Point (10, 100));

			path.SetMarkers ();
			path.StartFigure ();
			path.AddBezier( 10, 10, 50, 250, 100, 5, 200, 280);
			path.SetMarkers ();
			path.StartFigure ();
			path.AddRectangle (new Rectangle (10, 20, 300, 400));

			path.StartFigure ();
			path.AddLine (new Point (400, 400), new Point (400, 10));
			path.AddBezier( 100, 100, 500, 250, 150, 500, 250, 300);
			path.SetMarkers ();
			path.AddLine (new Point (400, 450), new Point (500, 510));
			path.SetMarkers ();
			path.CloseFigure ();

			path.Reverse ();

			PointF [] expectedPoints = new PointF [] {	new PointF(500f, 510f), 
														new PointF(400f, 450f), 
														new PointF(250f, 300f), 
														new PointF(150f, 500f), 
														new PointF(500f, 250f), 
														new PointF(100f, 100f), 
														new PointF(400f, 10f), 
														new PointF(400f, 400f), 
														new PointF(10f, 420f), 
														new PointF(310f, 420f), 
														new PointF(310f, 20f), 
														new PointF(10f, 20f), 
														new PointF(200f, 280f), 
														new PointF(100f, 5f), 
														new PointF(50f, 250f), 
														new PointF(10f, 10f), 
														new PointF(10f, 100f), 
														new PointF(400f, 200f), 
														new PointF(400f, 100f), 
														new PointF(100f, 100f)};
			
			for(int i = 0; i < path.PointCount; i++) {
				DrawingTest.AssertAlmostEqual(expectedPoints [i], path.PathPoints [i]);
			}

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

			for (int i=0; i < expectedTypes.Length; i++) {
				Assert.AreEqual (expectedTypes [i], path.PathTypes [i]);
			}	
			
			//t.AssertCompare ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:76,代码来源:GraphicsPath.cs

示例14: NextLinePath

 private void NextLinePath(ref GraphicsPath path4Bord, ref GraphicsPath path4Fill, Rectangle rect, 
                           Rectangle rectNext, Rectangle arc, int d, int charW)
 {
     if (rectNext.Width == 0) {
         arc.X = rect.Right  - d;
         arc.Y = rect.Bottom - d;
         path4Bord.AddArc(arc, 0, 90);
         path4Fill.AddArc(arc, 0, 90);
         arc.X = rect.Left;
         path4Bord.AddArc(arc, 90, 90);
         path4Fill.AddArc(arc, 90, 90);
     } else if (rectNext.Right > rect.Right) {
         if (d > (rectNext.Right - rect.Right)) {
             d = charW;
             arc.Width  = d;
             arc.Height = d;
         }
         arc.X = rect.Right;
         arc.Y = rect.Bottom - d;
         var p1 = new GraphicsPath();
         p1.AddArc(arc, 90, 90);
         p1.Reverse();
         path4Bord.AddPath(p1, true);
         path4Fill.AddPath(p1, true);
     } else if (rectNext.Right < rect.Right) {
         if (d > (rect.Right - rectNext.Right)) {
             d = charW;
             arc.Width  = d;
             arc.Height = d;
         }
         arc.X = rect.Right  - d;
         arc.Y = rect.Bottom - d;
         path4Bord.AddArc(arc, 0, 90);
         path4Fill.AddArc(arc, 0, 90);
         path4Bord.AddLines(new Point[] { new Point(rectNext.Right + d / 2, rect.Bottom) });
         path4Fill.AddLines(new Point[] { new Point(rectNext.Right + d / 2, rect.Bottom) });
     } else {
         path4Bord.AddLines(new Point[] { new Point(rect.Right, rect.Bottom  ) });
         path4Fill.AddLines(new Point[] { new Point(rect.Right, rect.Bottom+1) });
     }
 }
开发者ID:WendyH,项目名称:HMSEditor_addon,代码行数:41,代码来源:Style.cs

示例15: RenderArcScaleLines

        public static void RenderArcScaleLines(
                                                    this Graphics Graphics, Rectangle ClientRectangle, Point Center,
                                                    Int32 MinorTickOuterRadius, Int32 MinorTickInnerRadius, Int32 MinorTickWidth, Color MinorTickForeColor, Int32 MinorNumOfTicks,
                                                    Int32 IntermediateTickOuterRadius, Int32 IntermediateTickInnerRadius, Int32 IntermediateTickWidth, Color IntermediateTickForeColor,
                                                    Int32 MajorTickOuterRadius, Int32 MajorTickInnerRadius, Int32 MajorTickWidth, Color MajorTickForeColor, Single MajorStepValue,
                                                    Single MinimumValue, Single MaximumValue,
                                                    Int32 ArcStart, Int32 ArcSweep
            )
        {
            using (var graphicsPath = new GraphicsPath()) {
                var renderMajorScale = true;
                var renderIntermediateScale = true;
                var renderMinorScale = true;

                Graphics.SetClip(ClientRectangle);
                Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;

                Single countValue = 0;
                Int32 counter1 = 0;
                while (countValue <= (MaximumValue - MinimumValue)) {

                    graphicsPath.Reset();
                    if (renderMajorScale) {
                        graphicsPath.AddEllipse(new Rectangle(Center.X - MajorTickOuterRadius, Center.Y - MajorTickOuterRadius, 2 * MajorTickOuterRadius, 2 * MajorTickOuterRadius));
                        graphicsPath.Reverse();
                        graphicsPath.AddEllipse(new Rectangle(Center.X - MajorTickInnerRadius, Center.Y - MajorTickInnerRadius, 2 * MajorTickInnerRadius, 2 * MajorTickInnerRadius));
                        graphicsPath.Reverse();
                    }
                    Graphics.SetClip(graphicsPath);

                    using (var pen = new Pen(MajorTickForeColor, MajorTickWidth)) {
                        Graphics.DrawLine(
                                            pen,
                                            (Single)(Center.X),
                                            (Single)(Center.Y),
                                            (Single)(Center.X + 2 * MajorTickOuterRadius * Math.Cos((ArcStart + countValue * ArcSweep / (MaximumValue - MinimumValue)) * Math.PI / 180.0)),
                                            (Single)(Center.Y + 2 * MajorTickOuterRadius * Math.Sin((ArcStart + countValue * ArcSweep / (MaximumValue - MinimumValue)) * Math.PI / 180.0))
                                         );
                    }

                    graphicsPath.Reset();
                    if (renderMinorScale) {
                        graphicsPath.AddEllipse(new Rectangle(Center.X - MinorTickOuterRadius, Center.Y - MinorTickOuterRadius, 2 * MinorTickOuterRadius, 2 * MinorTickOuterRadius));
                        graphicsPath.Reverse();
                        graphicsPath.AddEllipse(new Rectangle(Center.X - MinorTickInnerRadius, Center.Y - MinorTickInnerRadius, 2 * MinorTickInnerRadius, 2 * MinorTickInnerRadius));
                        graphicsPath.Reverse();
                    }
                    Graphics.SetClip(graphicsPath);

                    if (countValue < (MaximumValue - MinimumValue)) {
                        for (var index = 1; index <= MinorNumOfTicks; index++) {
                            if (((MinorNumOfTicks % 2) == 1) && ((Int32)(MinorNumOfTicks / 2) + 1 == index)) {

                                graphicsPath.Reset();
                                if (renderIntermediateScale) {
                                    graphicsPath.AddEllipse(new Rectangle(Center.X - IntermediateTickOuterRadius, Center.Y - IntermediateTickOuterRadius, 2 * IntermediateTickOuterRadius, 2 * IntermediateTickOuterRadius));
                                    graphicsPath.Reverse();
                                    graphicsPath.AddEllipse(new Rectangle(Center.X - IntermediateTickInnerRadius, Center.Y - IntermediateTickInnerRadius, 2 * IntermediateTickInnerRadius, 2 * IntermediateTickInnerRadius));
                                    graphicsPath.Reverse();
                                }
                                Graphics.SetClip(graphicsPath);

                                using (var pen = new Pen(IntermediateTickForeColor, IntermediateTickWidth)) {
                                    Graphics.DrawLine(
                                                        pen,
                                                        (Single)(Center.X),
                                                        (Single)(Center.Y),
                                                        (Single)(Center.X + 2 * IntermediateTickOuterRadius * Math.Cos((ArcStart + countValue * ArcSweep / (MaximumValue - MinimumValue) + index * ArcSweep / (((Single)((MaximumValue - MinimumValue) / MajorStepValue)) * (MinorNumOfTicks + 1))) * Math.PI / 180.0)),
                                                        (Single)(Center.Y + 2 * IntermediateTickOuterRadius * Math.Sin((ArcStart + countValue * ArcSweep / (MaximumValue - MinimumValue) + index * ArcSweep / (((Single)((MaximumValue - MinimumValue) / MajorStepValue)) * (MinorNumOfTicks + 1))) * Math.PI / 180.0))
                                                      );
                                }

                                graphicsPath.Reset();
                                if (renderMinorScale) {
                                    graphicsPath.AddEllipse(new Rectangle(Center.X - MinorTickOuterRadius, Center.Y - MinorTickOuterRadius, 2 * MinorTickOuterRadius, 2 * MinorTickOuterRadius));
                                    graphicsPath.Reverse();
                                    graphicsPath.AddEllipse(new Rectangle(Center.X - MinorTickInnerRadius, Center.Y - MinorTickInnerRadius, 2 * MinorTickInnerRadius, 2 * MinorTickInnerRadius));
                                    graphicsPath.Reverse();
                                }
                                Graphics.SetClip(graphicsPath);

                            } else {
                                using (var pen = new Pen(MinorTickForeColor, MinorTickWidth)) {
                                    Graphics.DrawLine(
                                                        pen,
                                                        (Single)(Center.X),
                                                        (Single)(Center.Y),
                                                        (Single)(Center.X + 2 * MinorTickOuterRadius * Math.Cos((ArcStart + countValue * ArcSweep / (MaximumValue - MinimumValue) + index * ArcSweep / (((Single)((MaximumValue - MinimumValue) / MajorStepValue)) * (MinorNumOfTicks + 1))) * Math.PI / 180.0)),
                                                        (Single)(Center.Y + 2 * MinorTickOuterRadius * Math.Sin((ArcStart + countValue * ArcSweep / (MaximumValue - MinimumValue) + index * ArcSweep / (((Single)((MaximumValue - MinimumValue) / MajorStepValue)) * (MinorNumOfTicks + 1))) * Math.PI / 180.0))
                                                     );
                                }
                            }
                        }
                    }

                    countValue += MajorStepValue;
                    counter1++;
                }
            }
//.........这里部分代码省略.........
开发者ID:StewartScottRogers,项目名称:RealtimeControlsSolution,代码行数:101,代码来源:ArcScaleLineRenderer.cs


注:本文中的System.Drawing.Drawing2D.GraphicsPath.Reverse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。