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


C# System.Drawing.Drawing2D.GraphicsPath.CloseAllFigures方法代码示例

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


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

示例1: DrawFilledPath

        private void DrawFilledPath(SeriesBase series, System.Drawing.Pen pen,System.Drawing.Brush brush)
        {
            var path = new System.Drawing.Drawing2D.GraphicsPath();

            if (series is AreaSeries)
            {
                path.StartFigure();
                AreaSeries areaSeries = series as AreaSeries;
                var points = areaSeries.AreaPoints;
                var pointCount = areaSeries.AreaPoints.Count;
                for (int i = 0; i < pointCount - 1; i++)
                {
                    System.Drawing.PointF startPoint = points[i].AsDrawingPointF();
                    System.Drawing.PointF endPoint = points[i + 1].AsDrawingPointF();
                    path.AddLine(startPoint, endPoint);
                }

                path.CloseAllFigures();

                switch (RenderingMode)
                {
                    case RenderingMode.GDIRendering:
                        GDIGraphics.FillPath(brush, path);
                        break;
                    case RenderingMode.Default:
                        break;
                    case RenderingMode.WritableBitmap:
                        WritableBitmapGraphics.FillPath(brush, path);
                        break;
                    default:
                        break;
                }
            }
        }
开发者ID:jcw-,项目名称:sparrowtoolkit,代码行数:34,代码来源:AreaContainer.cs

示例2: Round

 // 圆角代码
 public void Round(System.Drawing.Region region)
 {
     // -----------------------------------------------------------------------------------------------
     // 已经是.net提供给我们的最容易的改窗体的属性了(以前要自己调API)
     System.Drawing.Drawing2D.GraphicsPath oPath = new System.Drawing.Drawing2D.GraphicsPath();
     int x = 0;
     int y = 0;
     int thisWidth = this.Width;
     int thisHeight = this.Height;
     int angle = _Radius;
     if (angle > 0)
     {
         System.Drawing.Graphics g = CreateGraphics();
         oPath.AddArc(x, y, angle, angle, 180, 90); // 左上角
         oPath.AddArc(thisWidth - angle, y, angle, angle, 270, 90); // 右上角
         oPath.AddArc(thisWidth - angle, thisHeight - angle, angle, angle, 0, 90); // 右下角
         oPath.AddArc(x, thisHeight - angle, angle, angle, 90, 90); // 左下角
         oPath.CloseAllFigures();
         Region = new System.Drawing.Region(oPath);
     }
     // -----------------------------------------------------------------------------------------------
     else
     {
         oPath.AddLine(x + angle, y, thisWidth - angle, y); // 顶端
         oPath.AddLine(thisWidth, y + angle, thisWidth, thisHeight - angle); // 右边
         oPath.AddLine(thisWidth - angle, thisHeight, x + angle, thisHeight); // 底边
         oPath.AddLine(x, y + angle, x, thisHeight - angle); // 左边
         oPath.CloseAllFigures();
         Region = new System.Drawing.Region(oPath);
     }
 }
开发者ID:freedomwork,项目名称:playground,代码行数:32,代码来源:RoundPanel.cs

示例3: DrawRoundRect

 public static System.Drawing.Drawing2D.GraphicsPath DrawRoundRect(int x, int y, int width, int height, int radius)
 {
     System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
     path.AddArc(x, y, radius, radius, 180f, 90f);
     path.AddArc(width - radius, y, radius, radius, 270f, 90f);
     path.AddArc(width - radius, height - radius, radius, radius, 0f, 90f);
     path.AddArc(x, height - radius, radius, radius, 90f, 90f);
     path.CloseAllFigures();
     return path;
 }
开发者ID:caocf,项目名称:workspace-kepler,代码行数:10,代码来源:TextBoxEx.cs

示例4: DrawFrame

        public static void DrawFrame(System.Drawing.Graphics dc, System.Drawing.RectangleF r, float cornerRadius, System.Drawing.Color color)
        {
            var pen = new System.Drawing.Pen(color);
            if (cornerRadius <= 0)
            {
                dc.DrawRectangle(pen, ColorPickerUtil.Rect(r));
                return;
            }
            cornerRadius = (float)System.Math.Min(cornerRadius, System.Math.Floor(r.Width) - 2);
            cornerRadius = (float)System.Math.Min(cornerRadius, System.Math.Floor(r.Height) - 2);

            var path = new System.Drawing.Drawing2D.GraphicsPath();
            path.AddArc(r.X, r.Y, cornerRadius, cornerRadius, 180, 90);
            path.AddArc(r.Right - cornerRadius, r.Y, cornerRadius, cornerRadius, 270, 90);
            path.AddArc(r.Right - cornerRadius, r.Bottom - cornerRadius, cornerRadius, cornerRadius, 0, 90);
            path.AddArc(r.X, r.Bottom - cornerRadius, cornerRadius, cornerRadius, 90, 90);
            path.CloseAllFigures();
            dc.DrawPath(pen, path);
        }
开发者ID:modulexcite,项目名称:Visio-Power-Tools,代码行数:19,代码来源:ColorPickerUtil.cs


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