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


C# GraphicsPath.CloseAllFigures方法代码示例

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


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

示例1: RecalcBrushes

        protected virtual void RecalcBrushes(Rectangle position, Painter.State state)
        {
            if (_lastPosition == null || _lastPosition.Value != position || _lastState == null ||_lastState.Value != state)
            {
                _lastState = state;
                if (state == State.Hover)
                    _borderPen = new Pen(Color.FromArgb(0x3c, 0x7f, 0xb1), 1);
                else if (state == State.Pressed)
                    _borderPen = new Pen(Color.FromArgb(0x18, 0x59, 0x8a), 1);
                else
                    _borderPen = new Pen(Color.FromArgb(0x9a, 0x9a, 0x9a), 1);

                _leftBounds = new Rectangle(position.X, position.Y, 8, position.Height);
                _leftBrush = CreateLeftBrush(_leftBounds, state);

                _middleBounds = new Rectangle(_leftBounds.Right, _leftBounds.Y, (int)((float)position.Width - 16), position.Height);
                _middleBrush = CreateMiddleBrush(_middleBounds, state);

                _rightBounds = new Rectangle(_middleBounds.Right, _leftBounds.Y, 8, position.Height);
                _rightBrush = CreateRightBrush(_rightBounds, state);

                _upperGradientPath = new GraphicsPath();
                _upperGradientPath.AddLine(position.X + 8, position.Y + 1, position.X + 8, position.Y + 5);
                _upperGradientPath.AddLine(position.X + 8, position.Y + 5, _middleBounds.Right, position.Y + 5);
                _upperGradientPath.AddLine(_middleBounds.Right, position.Y + 5, _rightBounds.Right - 1, position.Y + 1);
                _upperGradientPath.CloseAllFigures();

                _upperGradientRect = new Rectangle(position.X + 8, position.Y + 1, 10, 4);
                _upperGradientBrush = new LinearGradientBrush(_upperGradientRect, Color.FromArgb(0xed, 0xed, 0xed), Color.FromArgb(0xdd, 0xdd, 0xe0), LinearGradientMode.Vertical);

                _lastPosition = position;
            }
        }
开发者ID:deveck,项目名称:Deveck.Utils,代码行数:33,代码来源:WindowsStyledButtonPainter.cs

示例2: DrawMarker

        public void DrawMarker(DragDropMarkerRendererEventArgs e)
        {
            Graphics g = e.Graphics;
            Rectangle bounds = e.Bounds;
            if (bounds.IsEmpty || _MarkerColor.IsEmpty) return;

            if (bounds.Width == AdvTree.DragInsertMarkSize) // Vertical insert mark
            {
                using (SolidBrush brush = new SolidBrush(_MarkerColor))
                {
                    using (Pen pen = new Pen(brush, 1))
                    {
                        Point p = new Point(bounds.X + 4, bounds.Y);
                        g.DrawLine(pen, p.X, p.Y, p.X, bounds.Bottom - 1);
                    }

                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(bounds.X, bounds.Y, bounds.X + 8, bounds.Y );
                        path.AddLine(bounds.X + 8, bounds.Y, bounds.X + 4, bounds.Y + 4);
                        path.CloseAllFigures();
                        g.FillPath(brush, path);
                    }
                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(bounds.X, bounds.Bottom, bounds.X + 8, bounds.Bottom);
                        path.AddLine(bounds.X + 8, bounds.Bottom, bounds.X + 4, bounds.Bottom - 4);
                        path.CloseAllFigures();
                        g.FillPath(brush, path);
                    }
                }
            }
            else
            {
                // Horizontal insert mark
                using (SolidBrush brush = new SolidBrush(_MarkerColor))
                {
                    using (Pen pen = new Pen(brush, 1))
                    {
                        Point p = new Point(bounds.X, bounds.Y + 4);
                        g.DrawLine(pen, p.X, p.Y, bounds.Right - 1, p.Y);
                    }

                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(bounds.X, bounds.Y, bounds.X, bounds.Y + 8);
                        path.AddLine(bounds.X, bounds.Y + 8, bounds.X + 4, bounds.Y + 4);
                        path.CloseAllFigures();
                        g.FillPath(brush, path);
                    }
                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(bounds.Right, bounds.Y, bounds.Right, bounds.Y + 8);
                        path.AddLine(bounds.Right, bounds.Y + 8, bounds.Right - 4, bounds.Y + 4);
                        path.CloseAllFigures();
                        g.FillPath(brush, path);
                    }
                }
            }
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:60,代码来源:DragDropMarkerDisplay.cs

示例3: LinePenStyle

 /// <summary>
 /// Initializes the <see cref="T:LinePenStyle"/> class.
 /// </summary>
 static LinePenStyle()
 {
     Point[] ps = new Point[3] { new Point(-2, 0), new Point(0, 4), new Point(2, 0) };
     GraphicsPath gpath = new GraphicsPath();
     gpath.AddPolygon(ps);
     gpath.CloseAllFigures();
     mGeneralizationCap = new CustomLineCap(null, gpath);
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:11,代码来源:LinePenStyle.cs

示例4: ToRoundedCorneredGraphicsPath

        public static GraphicsPath ToRoundedCorneredGraphicsPath(this RectangleF rect, float radius)
        {
            var lGraphicsPath = new GraphicsPath();
            lGraphicsPath.AddArc(rect.Left, rect.Top, radius, radius, 180, 90);
            lGraphicsPath.AddArc(rect.Left + rect.Width - radius, rect.Top, radius, radius, 270, 90);
            lGraphicsPath.AddArc(rect.Left + rect.Width - radius, rect.Top + rect.Height - radius, radius, radius, 0, 90);
            lGraphicsPath.AddArc(rect.Left, rect.Top + rect.Height - radius, radius, radius, 90, 90);
            lGraphicsPath.CloseAllFigures();

            return lGraphicsPath;
        }
开发者ID:cmprog,项目名称:BeeFree2,代码行数:11,代码来源:RectangleExtensions.cs

示例5: FillRoundedRectangle

        public static void FillRoundedRectangle(this Graphics g, Brush brush, RectangleF bounds, float cornerRadius)
        {
            var lGraphicsPath = new GraphicsPath();
            lGraphicsPath.AddArc(bounds.Left, bounds.Top, cornerRadius, cornerRadius, 180, 90);
            lGraphicsPath.AddArc(bounds.Right - cornerRadius - 1, bounds.Top, cornerRadius, cornerRadius, 270, 90);
            lGraphicsPath.AddArc(bounds.Right - cornerRadius - 1, bounds.Bottom - cornerRadius - 1, cornerRadius, cornerRadius, 0, 90);
            lGraphicsPath.AddArc(bounds.Left, bounds.Bottom - cornerRadius - 1, cornerRadius, cornerRadius, 90, 90);
            lGraphicsPath.CloseAllFigures();

            g.FillPath(brush, lGraphicsPath);
        }
开发者ID:cmprog,项目名称:IssueTracker,代码行数:11,代码来源:GraphicsExtensions.cs

示例6: DrawRoundedRectangle

        public static void DrawRoundedRectangle(this Graphics g, Pen pen, RectangleF bounds, float cornerRadius)
        {
            var lGraphicsPath = new GraphicsPath();
            lGraphicsPath.AddArc(bounds.Left, bounds.Top, cornerRadius, cornerRadius, 180, 90);
            lGraphicsPath.AddArc(bounds.Right - cornerRadius - 1, bounds.Top, cornerRadius, cornerRadius, 270, 90);
            lGraphicsPath.AddArc(bounds.Right - cornerRadius - 1, bounds.Bottom - cornerRadius - 1, cornerRadius, cornerRadius, 0, 90);
            lGraphicsPath.AddArc(bounds.Left, bounds.Bottom - cornerRadius - 1, cornerRadius, cornerRadius, 90, 90);
            lGraphicsPath.CloseAllFigures();

            g.DrawPath(pen, lGraphicsPath);
        }
开发者ID:cmprog,项目名称:IssueTracker,代码行数:11,代码来源:GraphicsExtensions.cs

示例7: OnLoad

 protected override void OnLoad(EventArgs e)
 {
     int R = 100;                                        //圆角半径
     GraphicsPath path = new GraphicsPath();             //图形路径
     path.AddArc(this.Width - R, this.Height - R, R, R, 0, 90);//添加右下圆角
     path.AddArc(0, this.Height - R, R, R, 90, 90);      //添加左下圆角
     path.AddArc(0, 0, R, R, 180, 90);                   //添加左上圆角
     path.AddArc(this.Width - R, 0, R, R, 270, 90);      //添加右上圆角
     path.CloseAllFigures();                             //闭合路径
     this.Region = new Region(path);                     //设置窗体有效区域
 }
开发者ID:dalinhuang,项目名称:wdeqawes-efrwserd-rgtedrtf,代码行数:11,代码来源:FormSpecial.cs

示例8: BuildTriangleUp

        private GraphicsPath BuildTriangleUp(Rectangle bounds)
        {
            int xPadding = bounds.Width / 10;
            int yPadding = bounds.Height / 10;
            int triangleHalf = Math.Max(0, bounds.Width / 2 - xPadding);

            GraphicsPath triangle = new GraphicsPath();
            triangle.AddLine(bounds.Left + xPadding, bounds.Bottom - yPadding, bounds.Left + xPadding + 2 * triangleHalf, bounds.Bottom - yPadding);
            triangle.AddLine(bounds.Left + xPadding + 2 * triangleHalf, bounds.Bottom - yPadding, bounds.Left + xPadding + triangleHalf, bounds.Top + yPadding);
            triangle.CloseAllFigures();
            return triangle;
        }
开发者ID:deveck,项目名称:Deveck.Utils,代码行数:12,代码来源:SymbolPainter.cs

示例9: DrawRectangle

        private void DrawRectangle(Graphics gfx, Rectangle Bounds, Pen DrawPen, Brush FillBrush)
        {
            using (GraphicsPath gfxPath = new GraphicsPath())
            {
                DrawPen.EndCap = DrawPen.StartCap = LineCap.Flat;
                gfxPath.AddRectangle(Bounds);
                gfxPath.CloseAllFigures();

                gfx.FillPath(FillBrush, gfxPath);
                gfx.DrawPath(DrawPen, gfxPath);
            }
        }
开发者ID:amalapannuru,项目名称:RFC,代码行数:12,代码来源:btn_browse.aspx.cs

示例10: RoundBorderForm

        public static void RoundBorderForm(Form frm)
        {
            var bounds = new Rectangle(0, 0, frm.Width, frm.Height);
            const int cornerRadius = 18;
            var path = new GraphicsPath();
            path.AddArc(bounds.X, bounds.Y, cornerRadius, cornerRadius, 180, 90);
            path.AddArc(bounds.X + bounds.Width - cornerRadius, bounds.Y, cornerRadius, cornerRadius, 270, 90);
            path.AddArc(bounds.X + bounds.Width - cornerRadius, bounds.Y + bounds.Height - cornerRadius, cornerRadius, cornerRadius, 0, 90);
            path.AddArc(bounds.X, bounds.Y + bounds.Height - cornerRadius, cornerRadius, cornerRadius, 90, 90);
            path.CloseAllFigures();

            frm.Region = new Region(path);
        }
开发者ID:GetTabster,项目名称:Tabster,代码行数:13,代码来源:SplashScreen.cs

示例11: DrawGlyph

 public override void DrawGlyph(PaintEventArgs e, Rectangle bounds)
 {
     GraphicsPath path;
     int num = Math.Max(0, (bounds.Width - bounds.Height) / 2);
     int num2 = Math.Max(0, (bounds.Height - bounds.Width) / 2);
     bounds.Inflate(-num, -num2);
     if ((bounds.Width % 2) == 1)
     {
         bounds.Width--;
     }
     if ((bounds.Height % 2) == 1)
     {
         bounds.Height--;
     }
     if (bounds.Width > bounds.Height)
     {
         bounds.Width = bounds.Height;
     }
     if (bounds.Height > bounds.Width)
     {
         bounds.Height = bounds.Width;
     }
     bounds.Inflate(-2, -2);
     int width = bounds.Width;
     int num4 = width / 3;
     int num5 = width / 4;
     int num6 = bounds.X + (bounds.Width / 2);
     float x = bounds.X + (0.5f * (bounds.Width + 3));
     float num8 = x - 3f;
     SmoothingMode smoothingMode = e.Graphics.SmoothingMode;
     e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
     using (path = new GraphicsPath())
     {
         Point[] points = new Point[] { new Point(bounds.Left + num4, bounds.Bottom), new Point(bounds.Right - num4, bounds.Bottom), new Point(bounds.Right, bounds.Bottom - num4), new Point(bounds.Right, bounds.Top + num4), new Point(bounds.Right - num4, bounds.Top), new Point(bounds.Left + num4, bounds.Top), new Point(bounds.Left, bounds.Top + num4), new Point(bounds.Left, bounds.Bottom - num4) };
         path.AddLines(points);
         path.CloseAllFigures();
         e.Graphics.FillPath(Brushes.Red, path);
         e.Graphics.DrawPath(Pens.DarkGray, path);
     }
     using (path = new GraphicsPath())
     {
         PointF[] tfArray = new PointF[] { new PointF(num8, (float) ((bounds.Top + num5) - 1)), new PointF(x, (float) ((bounds.Top + num5) - 1)), new PointF(num6 + 1.2f, (-0.5f + bounds.Top) + ((bounds.Height * 2f) / 3f)), new PointF(num6 - 1.2f, (-0.5f + bounds.Top) + ((bounds.Height * 2f) / 3f)) };
         path.AddLines(tfArray);
         path.CloseAllFigures();
         e.Graphics.FillPath(Brushes.White, path);
     }
     RectangleF rect = new RectangleF((float) num6, (float) (bounds.Bottom - num5), 0f, 0f);
     rect.Inflate(1.5f, 1.5f);
     e.Graphics.FillEllipse(Brushes.White, rect);
     e.Graphics.SmoothingMode = smoothingMode;
 }
开发者ID:CuneytKukrer,项目名称:TestProject,代码行数:51,代码来源:ExceptionLineIndicator.cs

示例12: AddToDoForm_Paint

 private void AddToDoForm_Paint(object sender, PaintEventArgs e)
 {
     Graphics graphics = e.Graphics;
     int CornerRadius = 10;
     Pen pen = new Pen(Color.Black, 2);
     pen.EndCap = pen.StartCap = LineCap.Round;
     System.Drawing.Drawing2D.GraphicsPath gfxPath = new System.Drawing.Drawing2D.GraphicsPath();
     gfxPath.AddArc(0, 0, CornerRadius, CornerRadius, 180, 90);
     gfxPath.AddArc(0 + this.Width - CornerRadius, 0, CornerRadius, CornerRadius, 270, 90);
     gfxPath.AddArc(0 + this.Width - CornerRadius, 0 + this.Height - CornerRadius, CornerRadius, CornerRadius, 0, 90);
     gfxPath.AddArc(0, 0 + Bounds.Height - CornerRadius, CornerRadius, CornerRadius, 90, 90);
     gfxPath.CloseAllFigures();
     graphics.DrawPath(pen,gfxPath);
     this.Region = new Region(gfxPath);
 }
开发者ID:atanasov,项目名称:NaskoShell,代码行数:15,代码来源:AddToDoForm.cs

示例13: TrespassArea

        // Returns a percentage of the ErrorArea circle trespassing on the zone.
        // If anyone knows calculus better than me I'd welcome you to clean up this function =)
        public float TrespassArea(Point3D pntLocation, float flErrorRadius) {

            float flReturnPercentage = 0.0F;
            float flErrorArea = (float)(flErrorRadius * flErrorRadius * Math.PI);

            GraphicsPath gpLocationError = new GraphicsPath();
            gpLocationError.AddEllipse(new RectangleF(pntLocation.X - flErrorRadius, pntLocation.Y - flErrorRadius, flErrorRadius * 2, flErrorRadius * 2));
            gpLocationError.CloseAllFigures();

            Region regZone = new Region(this.ZoneGraphicsPath);
            regZone.Intersect(gpLocationError);
            RectangleF[] a_recScans = regZone.GetRegionScans(new Matrix());
            Rectangle recIntersection = new Rectangle(int.MaxValue, int.MaxValue, 0, 0);

            int iPixelCount = 0;

            if (a_recScans.Length > 0) {

                for (int i = 0; i < a_recScans.Length; i++) {
                    recIntersection.X = a_recScans[i].X < recIntersection.X ? (int)a_recScans[i].X : recIntersection.X;
                    recIntersection.Y = a_recScans[i].Y < recIntersection.Y ? (int)a_recScans[i].Y : recIntersection.Y;

                    recIntersection.Width = a_recScans[i].Right > recIntersection.Right ? (int)a_recScans[i].Right - recIntersection.X : recIntersection.Width;
                    recIntersection.Height = a_recScans[i].Bottom > recIntersection.Bottom ? (int)a_recScans[i].Bottom - recIntersection.Y : recIntersection.Height;
                }

                //recIntersection = this.RecFtoRec(regZone.GetBounds(this.CreateGraphics()));
                Point pntVisible = new Point(recIntersection.X, recIntersection.Y);

                for (pntVisible.X = recIntersection.X; pntVisible.X <= recIntersection.Right; pntVisible.X++) {
                    for (pntVisible.Y = recIntersection.Y; pntVisible.Y <= recIntersection.Bottom; pntVisible.Y++) {
                        if (regZone.IsVisible(pntVisible) == true) {
                            iPixelCount++;
                        }
                    }
                }
            }

            flReturnPercentage = (float)iPixelCount / flErrorArea;

            // Accounts for low error when using this method. (98.4% should be 100%)
            // but using regZone.GetRegionScans is slightly lossy.
            if (flReturnPercentage > 0.0F) {
                flReturnPercentage = (float)Math.Min(1.0F, flReturnPercentage + 0.02);
            }

            return flReturnPercentage;
        }
开发者ID:ratdart,项目名称:Procon-1,代码行数:50,代码来源:MapZoneDrawing.cs

示例14: DrawRoundedRectangle

        private void DrawRoundedRectangle(Graphics gfx, Rectangle Bounds, int CornerRadius, Pen DrawPen, Brush FillBrush)
        {
            using (GraphicsPath gfxPath = new GraphicsPath())
            {
                DrawPen.EndCap = DrawPen.StartCap = LineCap.Round;

                gfxPath.AddArc(Bounds.X, Bounds.Y, CornerRadius, CornerRadius, 180, 90);
                gfxPath.AddArc(Bounds.X + Bounds.Width - CornerRadius, Bounds.Y, CornerRadius, CornerRadius, 270, 90);
                gfxPath.AddArc(Bounds.X + Bounds.Width - CornerRadius, Bounds.Y + Bounds.Height - CornerRadius, CornerRadius, CornerRadius, 0, 90);
                gfxPath.AddArc(Bounds.X, Bounds.Y + Bounds.Height - CornerRadius, CornerRadius, CornerRadius, 90, 90);
                gfxPath.CloseAllFigures();

                gfx.FillPath(FillBrush, gfxPath);
                gfx.DrawPath(DrawPen, gfxPath);
            }
        }
开发者ID:amalapannuru,项目名称:RFC,代码行数:16,代码来源:btn_browse.aspx.cs

示例15: DrawRoundedRectangle

        private void DrawRoundedRectangle(Graphics gfx, Rectangle Bounds, int CornerRadius, Pen DrawPen)
        {
            int strokeOffset = Convert.ToInt32(Math.Ceiling(DrawPen.Width));
            Bounds = Rectangle.Inflate(Bounds, -strokeOffset, -strokeOffset);

            DrawPen.EndCap = DrawPen.StartCap = LineCap.Round;

            GraphicsPath gfxPath = new GraphicsPath();
            gfxPath.AddArc(Bounds.X, Bounds.Y, CornerRadius, CornerRadius, 180, 90);
            gfxPath.AddArc(Bounds.X + Bounds.Width - CornerRadius, Bounds.Y, CornerRadius, CornerRadius, 270, 90);
            gfxPath.AddArc(Bounds.X + Bounds.Width - CornerRadius, Bounds.Y + Bounds.Height - CornerRadius, CornerRadius, CornerRadius, 0, 90);
            gfxPath.AddArc(Bounds.X, Bounds.Y + Bounds.Height - CornerRadius, CornerRadius, CornerRadius, 90, 90);
            gfxPath.CloseAllFigures();

            //gfx.FillPath(new SolidBrush(FillColor), gfxPath);
            gfx.DrawPath(DrawPen, gfxPath);
        }
开发者ID:m9731526,项目名称:NeoEditor,代码行数:17,代码来源:GhostButton.cs


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