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


C# GraphicsPath.CloseFigure方法代码示例

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


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

示例1: DrawYourSelf

        public override void DrawYourSelf(Graphics graphics)
        {
            GraphicsPath path = new GraphicsPath();
            path.StartFigure();
            path.AddLine(Location.X, Location.Y + ModelSize.Height / 3, Location.X + ModelSize.Width, Location.Y + ModelSize.Height / 3);
            path.CloseFigure();
            path.StartFigure();
            path.AddLine(Location.X, Location.Y + (ModelSize.Height / 3) * 2, Location.X + ModelSize.Width, Location.Y + (ModelSize.Height * 2) / 3);
            path.CloseFigure();
            path.AddEllipse(new RectangleF(Location, ModelSize));
            path.CloseFigure();
            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,代码行数:26,代码来源:EllipseLineIntersectionShape.cs

示例2: DrawYourSelf

        /// <summary>
        /// Изчертава елипсите.
        /// </summary>
        /// <param name="graphics"></param>
        public override void DrawYourSelf(Graphics graphics)
        {
            GraphicsPath path = new GraphicsPath();
            path.StartFigure();
            path.AddEllipse(Location.X + ModelSize.Width / 3, Location.Y + ModelSize.Height / 3, ModelSize.Width / 3, ModelSize.Height / 3);
            path.CloseFigure();
            path.StartFigure();
            path.AddLine(Location.X + (ModelSize.Width * 2) / 3, Location.Y + ModelSize.Height / 2, Location.X + ModelSize.Width, Location.Y + ModelSize.Height / 2);
            path.CloseFigure();
            path.AddEllipse(new RectangleF(Location, ModelSize));
            path.CloseFigure();
            path.Transform(this.TMatrix.TransformationMatrix);

            /*
             * Създава се Pen, който изчертава контура, като използва
             * цвят и дебелина (определят се от конструктора)
             */
            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,代码行数:35,代码来源:ConnectedEllipses.cs

示例3: GetGreaterSeries

 /// <summary>
 /// Creates a pattern symbolizing a linestring like this <c>&gt;&gt;&gt;&gt;&gt;</c>
 /// </summary>
 /// <param name="x">The length of the peak</param>
 /// <param name="y">the offset left and right from the original line</param>
 /// <returns>The pattern</returns>
 public static GraphicsPath GetGreaterSeries(float x, float y)
 {
     var gp = new GraphicsPath();
     gp.AddLine(new PointF(0.5f*x, y), new PointF(1.5f * x, 0f));
     gp.CloseFigure();
     gp.AddLine(new PointF(1.5f * x, 0f), new PointF(0.5f*x, -y));
     gp.CloseFigure();
     return gp;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:15,代码来源:WarpedLineSymbolizer.cs

示例4: GetTriangleSeries

 /// <summary>
 /// Creates a triangle pattern
 /// </summary>
 /// <param name="x">The base length of the triangle</param>
 /// <param name="y">The location of the next triangle</param>
 /// <returns></returns>
 public static GraphicsPath GetTriangleSeries(float x, float y)
 {
     var gp = new GraphicsPath();
     gp.AddPolygon(new[] { new PointF(x, 0f), new PointF(0f, 0f), new PointF(0.5f*x, 2f*x/3f), new PointF(x, 0f) });
     gp.CloseFigure();
     
     //Just to move to a new position
     gp.AddEllipse(y, 0f, 0f, 0f);
     gp.CloseFigure();
     return gp;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:17,代码来源:WarpedLineSymbolizer.cs

示例5: GetZigZag

 /// <summary>
 /// Create a "zigzag" pattern, sort of like a rotated by 90 degree Z
 /// </summary>
 /// <param name="x">The width of a step op the linestring axis.</param>
 /// <param name="y">The offset left and right from the axis.</param>
 /// <returns>The pattern</returns>
 public static GraphicsPath GetZigZag(float x, float y)
 {
     var gp = new GraphicsPath();
     gp.AddLine(new PointF(0f, 0f), new PointF(0f, y));
     gp.CloseFigure();
     gp.AddLine(new PointF(0f, y), new PointF(2*x, -y));
     gp.CloseFigure();
     gp.AddLine(new PointF(2*x, -y), new PointF(2*x, 0));
     gp.CloseFigure();
     return gp;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:17,代码来源:WarpedLineSymbolizer.cs

示例6: Form1_Paint

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            GraphicsPath Path = new GraphicsPath();

            Path.AddLine(10, 10, 50, 50);
            Path.AddLine(100, 50, 140, 10);
            Path.CloseFigure();
            Path.StartFigure();
            Path.AddLine(140, 80, 100, 120);
            Path.AddLine(100, 150, 140, 190);
            Path.CloseFigure();

            e.Graphics.DrawPath(Pens.Black, Path);
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:14,代码来源:Form1.cs

示例7: ReturnBounds

        public override RectangleF ReturnBounds()
        {
            GraphicsPath path = new GraphicsPath();
            path.StartFigure();
            path.AddLine(Location.X, Location.Y + ModelSize.Height / 3, Location.X + ModelSize.Width, Location.Y + ModelSize.Height / 3);
            path.CloseFigure();
            path.StartFigure();
            path.AddLine(Location.X, Location.Y + (ModelSize.Height / 3) * 2, Location.X + ModelSize.Width, Location.Y + (ModelSize.Height * 2) / 3);
            path.CloseFigure();
            path.AddEllipse(new RectangleF(Location, ModelSize));
            path.CloseFigure();
            path.Transform(this.TMatrix.TransformationMatrix);

            return path.GetBounds();
        }
开发者ID:ferry2,项目名称:2D-Vector-Graphics,代码行数:15,代码来源:EllipseLineIntersectionShape.cs

示例8: RecreatePath

		private void RecreatePath()
		{
			path = new GraphicsPath();
			if (tlRad > 0)
				path.AddArc(AbsoluteX, AbsoluteY, tlRad, tlRad, 180, 90);
			else
				path.AddLine(AbsoluteX, AbsoluteY, AbsoluteX, AbsoluteY);
			
			if (trRad > 0)
				path.AddArc(AbsoluteX + ActualWidth - trRad, AbsoluteY, trRad, trRad, 270, 90);
			else
				path.AddLine(AbsoluteX + ActualWidth, AbsoluteY, AbsoluteX + ActualWidth, AbsoluteY);
			
			if (brRad > 0)
				path.AddArc(AbsoluteX + ActualWidth - brRad, AbsoluteY + ActualHeight - brRad, brRad, brRad, 0, 90);
			else
				path.AddLine(AbsoluteX + ActualWidth, AbsoluteY + ActualHeight, AbsoluteX + ActualWidth, AbsoluteY + ActualHeight);
			
			if (blRad > 0)
				path.AddArc(AbsoluteX, AbsoluteY + ActualHeight - blRad, blRad, blRad, 90, 90);
			else
				path.AddLine(AbsoluteX, AbsoluteY + ActualHeight, AbsoluteX, AbsoluteY + ActualHeight);
			
			path.CloseFigure();
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:25,代码来源:DrawableRectangle.cs

示例9: Draw

        protected override void Draw(Graphics g)
        {
            g.SmoothingMode = SmoothingMode.HighQuality;

            regionFillPath = new GraphicsPath();

            for (int i = 0; i < nodes.Count - 1; i++)
            {
                regionFillPath.AddLine(nodes[i].Position, nodes[i + 1].Position);
            }

            if (nodes.Count > 2)
            {
                regionFillPath.CloseFigure();

                using (Region region = new Region(regionFillPath))
                {
                    g.Clip = region;
                    g.FillRectangle(lightBackgroundBrush, ScreenRectangle0Based);
                    g.ResetClip();
                }

                g.DrawRectangleProper(borderPen, currentArea);
            }

            if (nodes.Count > 1)
            {
                g.DrawPath(borderPen, regionFillPath);
                g.DrawPath(borderDotPen, regionFillPath);
            }

            base.Draw(g);
        }
开发者ID:Edison6351,项目名称:ShareX,代码行数:33,代码来源:PolygonRegion.cs

示例10: OnPaint

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (BorderRadius == 0)
            {
                Rectangle rc = ClientRectangle;
                rc.Inflate(-(int)Math.Round(BorderWidth / 2.0 + .5), -(int)Math.Round(BorderWidth / 2.0 + .5));

                rc.Y = rc.Y - 1;
                rc.Height = rc.Height + 1;

                e.Graphics.DrawRectangle(new Pen(BorderColor, BorderWidth), rc);
            }
            else
            {
                e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                GraphicsPath gp = Extensions.Create(0, 0, Width - 2, Height - 2, BorderRadius);
                Pen p = new Pen(BorderColor, BorderWidth);

                e.Graphics.DrawPath(p, gp);
                e.Graphics.FillPath(p.Brush, gp);

                StringFormat formatting = (StringFormat)StringFormat.GenericTypographic.Clone();
                formatting.Alignment = StringAlignment.Center;
                formatting.LineAlignment = StringAlignment.Center;

                float emsize = e.Graphics.DpiY * Font.Size / 72;
                gp = new GraphicsPath();
                gp.StartFigure();
                gp.AddString(Text, Font.FontFamily, (int)Font.Style, emsize, new Point(Width / 2, Height / 2), formatting);
                gp.CloseFigure();
                e.Graphics.FillPath(new Pen(ForeColor, 1).Brush, gp);
            }
        }
开发者ID:seanfuture,项目名称:Slack,代码行数:35,代码来源:CustomButton.cs

示例11: GetRoundedRectangle

        public static GraphicsPath GetRoundedRectangle(RectangleF rect, float arcRadius)
        {
            var x = rect.X;
            var y = rect.Y;
            var w = rect.Width;
            var h = rect.Height;
            var d = 2 * arcRadius;

            var gp = new GraphicsPath();
            if(arcRadius == 0)
            {
                gp.AddRectangle(rect);
            }
            else
            {
                gp.AddArc(x, y, d, d, 180, 90);
                gp.AddLine(x + arcRadius, y, x + w - arcRadius - 1, y);
                gp.AddArc(x + w - d - 1, y, d, d, 270, 90);
                gp.AddLine(x + w - 1, y + arcRadius, x + w - 1, y + h - arcRadius - 1);
                gp.AddArc(x + w - d - 1, y + h - d - 1, d, d, 0, 90);
                gp.AddLine(x + w - arcRadius - 1, y + h - 1, x + arcRadius, y + h - 1);
                gp.AddArc(x, y + h - d - 1, d, d, 90, 90);
                gp.AddLine(x, y + h - arcRadius - 1, x, y + arcRadius);
            }
            gp.CloseFigure();
            return gp;
        }
开发者ID:Kuzq,项目名称:gitter,代码行数:27,代码来源:GraphicsUtility.cs

示例12: DrawArc

        public static void DrawArc(Rectangle re, GraphicsPath pa, int radius, EGroupPos _grouppos)
        {
            int radiusX0Y0 = radius,
                radiusXfy0 = radius,
                radiusX0Yf = radius,
                radiusXfyf = radius;

            switch (_grouppos)
            {
                case EGroupPos.Left:
                    radiusXfy0 = 1; radiusXfyf = 1;
                    break;
                case EGroupPos.Center:
                    radiusX0Y0 = 1; radiusX0Yf = 1; radiusXfy0 = 1; radiusXfyf = 1;
                    break;
                case EGroupPos.Right:
                    radiusX0Y0 = 1; radiusX0Yf = 1;
                    break;
                case EGroupPos.Top:
                    radiusX0Yf = 1; radiusXfyf = 1;
                    break;
                case EGroupPos.Bottom:
                    radiusX0Y0 = 1; radiusXfy0 = 1;
                    break;
            }
            pa.AddArc(re.X, re.Y, radiusX0Y0, radiusX0Y0, 180, 90);
            pa.AddArc(re.Width - radiusXfy0, re.Y, radiusXfy0, radiusXfy0, 270, 90);
            pa.AddArc(re.Width - radiusXfyf, re.Height - radiusXfyf, radiusXfyf, radiusXfyf, 0, 90);
            pa.AddArc(re.X, re.Height - radiusX0Yf, radiusX0Yf, radiusX0Yf, 90, 90);
            pa.CloseFigure();
        }
开发者ID:GarnettLuo,项目名称:XiaoCai.WinformUI,代码行数:31,代码来源:StyleHelp.cs

示例13: GenerateCapsule

		private static GraphicsPath GenerateCapsule( this Graphics graphics, RectangleF rectangle ) {
			float diameter;
			RectangleF arc;
			GraphicsPath path = new GraphicsPath();

			try {
				if( rectangle.Width > rectangle.Height ) {
					diameter = rectangle.Height;
					SizeF sizeF = new SizeF( diameter, diameter );
					arc = new RectangleF( rectangle.Location, sizeF );
					path.AddArc( arc, 90, 180 );
					arc.X = rectangle.Right - diameter;
					path.AddArc( arc, 270, 180 );
				} else if( rectangle.Width < rectangle.Height ) {
					diameter = rectangle.Width;
					SizeF sizeF = new SizeF( diameter, diameter );
					arc = new RectangleF( rectangle.Location, sizeF );
					path.AddArc( arc, 180, 180 );
					arc.Y = rectangle.Bottom - diameter;
					path.AddArc( arc, 0, 180 );
				} else
					path.AddEllipse( rectangle );
			} catch { path.AddEllipse( rectangle ); } finally { path.CloseFigure(); }
			return path;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:25,代码来源:GraphicsExtension.cs

示例14: Draw

        protected override void Draw(Graphics g)
        {
            regionFillPath = new GraphicsPath();

            for (int i = 0; i < nodes.Count - 1; i++)
            {
                regionFillPath.AddLine(nodes[i].Position, nodes[i + 1].Position);
            }

            if (nodes.Count > 2)
            {
                regionFillPath.CloseFigure();

                using (Region region = new Region(regionFillPath))
                {
                    g.ExcludeClip(region);
                    g.FillRectangle(shadowBrush, 0, 0, Width, Height);
                    g.ResetClip();
                }

                g.DrawRectangleProper(borderPen, currentArea);
            }
            else
            {
                g.FillRectangle(shadowBrush, 0, 0, Width, Height);
            }

            if (nodes.Count > 1)
            {
                g.DrawPath(borderPen, regionFillPath);
            }

            base.Draw(g);
        }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:34,代码来源:PolygonRegion.cs

示例15: CreateRoundedRectanglePath

        // Create a rounded rectangle path with a given Rectangle and a given corner Diameter
        public static GraphicsPath CreateRoundedRectanglePath(Rectangle rect, float diameter)
        {
            GraphicsPath path = new GraphicsPath ();
            RectangleF arcrect = new RectangleF (rect.Location, new SizeF (diameter, diameter));

            // Top left arc
            path.AddArc (arcrect, 190, 90);
            path.AddLine (rect.Left + (int)(diameter / 2), rect.Top, rect.Left + rect.Width  - (int)(diameter / 2), rect.Top);

            // Top right arc
            arcrect.X = rect.Right - diameter;
            path.AddArc (arcrect, 270, 90);
            path.AddLine (rect.Left + rect.Width, rect.Top + (int)(diameter / 2), rect.Left + rect.Width, rect.Top + rect.Height - (int)(diameter / 2));

            // Bottom right arc
            arcrect.Y = rect.Bottom - diameter;
            path.AddArc (arcrect, 0, 90);

            // Bottom left arc
            arcrect.X = rect.Left;
            path.AddArc (arcrect, 90, 90);

            path.CloseFigure ();
            return path;
        }
开发者ID:noismaster,项目名称:xmppapplication,代码行数:26,代码来源:PaintFunctions.cs


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