• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# RoundStyle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中RoundStyle的典型用法代码示例。如果您正苦于以下问题:C# RoundStyle类的具体用法?C# RoundStyle怎么用?C# RoundStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RoundStyle类属于命名空间,在下文中一共展示了RoundStyle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RenderBorder

        public static void RenderBorder(Graphics g, Rectangle rect, Color borderColor,
            ButtonBorderType borderType, int radius, RoundStyle roundType)
        {
            rect.Width--;
            rect.Height--;

            bool simpleRect = (borderType == ButtonBorderType.Rectangle && (roundType == RoundStyle.None || radius < 2));
            SmoothingMode newMode = simpleRect ? SmoothingMode.HighSpeed : SmoothingMode.AntiAlias;

            using (NewSmoothModeGraphics ng = new NewSmoothModeGraphics(g, newMode))
            {
                using (Pen p = new Pen(borderColor))
                {
                    if (simpleRect)
                    {
                        g.DrawRectangle(p, rect);
                    }
                    else if (borderType == ButtonBorderType.Ellipse)
                    {
                        g.DrawEllipse(p, rect);
                    }
                    else
                    {
                        using (GraphicsPath path = GraphicsPathHelper.CreateRoundedRect(rect, radius, roundType, false))
                        {
                            g.DrawPath(p, path);
                        }
                    }
                }
            }
        }
开发者ID:webxiaohua,项目名称:SmartControls,代码行数:31,代码来源:BasicBlockPainter.cs


示例2: RenderBackgroundInternal

 internal static void RenderBackgroundInternal(
    Graphics g,
    Rectangle rect,
    Color baseColor,
    Color borderColor,
    Color innerBorderColor,
    RoundStyle style,
    int roundWidth,
    bool drawBorder,
    bool drawGlass,
    LinearGradientMode mode)
 {
     RenderBackgroundInternal(
          g,
          rect,
          baseColor,
          borderColor,
          innerBorderColor,
          style,
          8,
          0.45f,
          drawBorder,
          drawGlass,
          mode);
 }
开发者ID:GarnettLuo,项目名称:XiaoCai.WinformUI,代码行数:25,代码来源:RenderHelper.cs


示例3: CreatePath

        public static GraphicsPath CreatePath(Rectangle rect, int radius, RoundStyle style, bool correction)
        {
            GraphicsPath path = new GraphicsPath();
            int radiusCorrection = correction ? 1 : 0;
            switch (style)
            {
                case RoundStyle.None:
                    path.AddRectangle(rect);
                    break;

                case RoundStyle.All:
                    path.AddArc(rect.X, rect.Y, radius, radius, 180f, 90f);
                    path.AddArc((rect.Right - radius) - radiusCorrection, rect.Y, radius, radius, 270f, 90f);
                    path.AddArc((rect.Right - radius) - radiusCorrection, (rect.Bottom - radius) - radiusCorrection, radius, radius, 0f, 90f);
                    path.AddArc(rect.X, (rect.Bottom - radius) - radiusCorrection, radius, radius, 90f, 90f);
                    break;

                case RoundStyle.Left:
                    path.AddArc(rect.X, rect.Y, radius, radius, 180f, 90f);
                    path.AddLine(rect.Right - radiusCorrection, rect.Y, rect.Right - radiusCorrection, rect.Bottom - radiusCorrection);
                    path.AddArc(rect.X, (rect.Bottom - radius) - radiusCorrection, radius, radius, 90f, 90f);
                    break;

                case RoundStyle.Right:
                    path.AddArc((rect.Right - radius) - radiusCorrection, rect.Y, radius, radius, 270f, 90f);
                    path.AddArc((rect.Right - radius) - radiusCorrection, (rect.Bottom - radius) - radiusCorrection, radius, radius, 0f, 90f);
                    path.AddLine(rect.X, rect.Bottom - radiusCorrection, rect.X, rect.Y);
                    break;

                case RoundStyle.Top:
                    path.AddArc(rect.X, rect.Y, radius, radius, 180f, 90f);
                    path.AddArc((rect.Right - radius) - radiusCorrection, rect.Y, radius, radius, 270f, 90f);
                    path.AddLine(rect.Right - radiusCorrection, rect.Bottom - radiusCorrection, rect.X, rect.Bottom - radiusCorrection);
                    break;

                case RoundStyle.Bottom:
                    path.AddArc((rect.Right - radius) - radiusCorrection, (rect.Bottom - radius) - radiusCorrection, radius, radius, 0f, 90f);
                    path.AddArc(rect.X, (rect.Bottom - radius) - radiusCorrection, radius, radius, 90f, 90f);
                    path.AddLine(rect.X, rect.Y, rect.Right - radiusCorrection, rect.Y);
                    break;

                case RoundStyle.BottomLeft:
                    path.AddArc(rect.X, (rect.Bottom - radius) - radiusCorrection, radius, radius, 90f, 90f);
                    path.AddLine(rect.X, rect.Y, rect.Right - radiusCorrection, rect.Y);
                    path.AddLine(rect.Right - radiusCorrection, rect.Y, rect.Right - radiusCorrection, rect.Bottom - radiusCorrection);
                    break;

                case RoundStyle.BottomRight:
                    path.AddArc((rect.Right - radius) - radiusCorrection, (rect.Bottom - radius) - radiusCorrection, radius, radius, 0f, 90f);
                    path.AddLine(rect.X, rect.Bottom - radiusCorrection, rect.X, rect.Y);
                    path.AddLine(rect.X, rect.Y, rect.Right - radiusCorrection, rect.Y);
                    break;
            }
            path.CloseFigure();
            return path;
        }
开发者ID:zhushengwen,项目名称:example-zhushengwen,代码行数:56,代码来源:GraphicsPathHelper.cs


示例4: CreateRegion

 public static void CreateRegion(Control control, Rectangle bounds, int radius, RoundStyle roundStyle)
 {
     using (GraphicsPath path = GraphicsPathHelper.CreatePath(bounds, radius, roundStyle, true))
     {
         Region region = new Region(path);
         path.Widen(Pens.White);
         region.Union(path);
         if (control.Region != null)
         {
             control.Region.Dispose();
         }
         control.Region = region;
     }
 }
开发者ID:jxdong1013,项目名称:archivems,代码行数:14,代码来源:RegionHelper.cs


示例5: Awake

 /// <summary>
 /// 
 /// </summary>
 void Awake()
 {
     //When you start from room scene, return to lobby for connect to server first.
     if (!PhotonNetwork.connected || PhotonNetwork.room == null)
     {
         Application.LoadLevel(0);
         return;
     }
     isFinish = false;
     if ((string)PhotonNetwork.room.customProperties[PropiertiesKeys.RoomRoundKey] == "1")
     {
         m_RoundStyle = RoundStyle.Rounds;
     }
     else
     {
         m_RoundStyle = RoundStyle.OneMacht;
     }
     GetTime();
 }
开发者ID:tegleg,项目名称:mfp,代码行数:22,代码来源:bl_RoundTime.cs


示例6: RenderRectangleGlass

        public static void RenderRectangleGlass(Graphics g, Rectangle ownerRect,
            int ownerRadius, RoundStyle ownerRoundTye, GlassPosition position,
            float angle, float glassLengthFactor, Color glassColor, int alpha1, int alpha2)
        {
            if (!(glassLengthFactor > 0 && glassLengthFactor < 1))
                throw new ArgumentException("glassLengthFactor must be between 0 and 1, but not include 0 and 1. ",
                    "glassLengthFactor");

            Rectangle rect = CalcGlassRect(ownerRect, position, glassLengthFactor);
            RoundStyle round = CalcRoundStyle(position, ownerRadius, ownerRoundTye);
            if (rect.Width < 1 || rect.Height < 1)
                return;

            BasicBlockPainter.RenderLinearGradientBackground(
                g,
                rect,
                Color.FromArgb(alpha1, glassColor),
                Color.FromArgb(alpha2, glassColor),
                angle,
                ownerRadius,
                round);
        }
开发者ID:webxiaohua,项目名称:SmartControls,代码行数:22,代码来源:GlassPainter.cs


示例7: RenderBackgroundInternal

 internal static void RenderBackgroundInternal(
     Graphics g,
     Rectangle rect,
     Color baseColor,
     Color borderColor,
     Color innerBorderColor,
     RoundStyle style,
     bool drawBorder,
     bool drawGlass,
     System.Drawing.Drawing2D.LinearGradientMode mode)
 {
     RenderBackgroundInternal(
         g,
         rect,
         baseColor,
         borderColor,
         innerBorderColor,
         style,
         8,
         drawBorder,
         drawGlass,
         mode);
 }
开发者ID:caocf,项目名称:workspace-kepler,代码行数:23,代码来源:RenderHelper.cs


示例8: RenderFlatBackground

 public static void RenderFlatBackground(Graphics g, Rectangle rect, Color backColor,
     ButtonBorderType borderType, int radius, RoundStyle roundType)
 {
     SmoothingMode newMode;
     bool simpleRect = (borderType == ButtonBorderType.Rectangle && (roundType == RoundStyle.None || radius < 2));
     if (simpleRect)
     {
         newMode = SmoothingMode.HighSpeed;
     }
     else
     {
         newMode = SmoothingMode.AntiAlias;
         rect.Width--;
         rect.Height--;
     }
     using (NewSmoothModeGraphics ng = new NewSmoothModeGraphics(g, newMode))
     {
         using (SolidBrush sb = new SolidBrush(backColor))
         {
             if (simpleRect)
             {
                 g.FillRectangle(sb, rect);
             }
             else if (borderType == ButtonBorderType.Ellipse)
             {
                 g.FillEllipse(sb, rect);
             }
             else
             {
                 using (GraphicsPath path = GraphicsPathHelper.CreateRoundedRect(rect, radius, roundType, false))
                 {
                     g.FillPath(sb, path);
                 }
             }
         }
     }
 }
开发者ID:webxiaohua,项目名称:SmartControls,代码行数:37,代码来源:BasicBlockPainter.cs


示例9: RenderLinearGradientBackground

        public static void RenderLinearGradientBackground(Graphics g, Rectangle rect,
            Color color1, Color color2, float angle, int radius, RoundStyle roundType)
        {
            SmoothingMode newMode;
            bool simpleRect = (roundType == RoundStyle.None || radius < 2);
            if (simpleRect)
            {
                newMode = SmoothingMode.HighSpeed;
            }
            else
            {
                newMode = SmoothingMode.AntiAlias;
                rect.Width--;
                rect.Height--;
            }

            if (rect.Width < 1 || rect.Height < 1)
                return;

            using (NewSmoothModeGraphics ng = new NewSmoothModeGraphics(g, newMode))
            {
                using (LinearGradientBrush lb = new LinearGradientBrush(
                    rect, color1, color2, angle))
                {
                    if (simpleRect)
                    {
                        g.FillRectangle(lb, rect);
                    }
                    else
                    {
                        using (GraphicsPath path = GraphicsPathHelper.CreateRoundedRect(rect, radius, roundType, false))
                        {
                            g.FillPath(lb, path);
                        }
                    }
                }
            }
        }
开发者ID:webxiaohua,项目名称:SmartControls,代码行数:38,代码来源:BasicBlockPainter.cs


示例10: RenderScrollBarArrowInternal

        internal void RenderScrollBarArrowInternal(
         Graphics g,
         Rectangle rect,
         //Color baseColor,
         //Color borderColor,
         //Color innerBorderColor,
         Color arrowColor,
         RoundStyle roundStyle,
         bool drawBorder,
         bool drawGlass,
         ArrowDirection arrowDirection,
         LinearGradientMode mode)
        {
            //RenderHelper.RenderBackgroundInternal(
            //   g,
            //   rect,
            //   baseColor,
            //   borderColor,
            //   innerBorderColor,
            //   roundStyle,
            //   0,
            //   .45F,
            //   drawBorder,
            //   drawGlass,
            //   mode);

            using (SolidBrush brush = new SolidBrush(arrowColor))
            {
                RenderArrowInternal(
                    g,
                    rect,
                    arrowDirection,
                    brush);
            }
        }
开发者ID:jxdong1013,项目名称:archivems,代码行数:35,代码来源:TCComboBox.cs


示例11: DrawCaptionBorder

 private void DrawCaptionBorder(Graphics g, Rectangle captionRect , int roundWidth , RoundStyle style , Color innerBorderColor )
 {
     using (GraphicsPath path =
                  GraphicsPathHelper.CreatePath(captionRect, roundWidth, style, false))
     {
         using (Pen pen = new Pen(innerBorderColor))
         {
             g.SmoothingMode = SmoothingMode.AntiAlias;
             g.DrawPath(pen, path);
         }
     }
 }
开发者ID:jxdong1013,项目名称:archivems,代码行数:12,代码来源:SkinFormPictureRenderer.cs


示例12: CreateRoundedRect

        public static GraphicsPath CreateRoundedRect(Rectangle rect, int radius, RoundStyle type, bool shorten)
        {
            GraphicsPath path = new GraphicsPath();

            if (shorten)
            {
                rect.Width--;
                rect.Height--;
            }

            if (radius < 2)
                type = RoundStyle.None;

            Rectangle rectTopLeft = new Rectangle(rect.X, rect.Y, radius, radius);
            Rectangle rectTopRight = new Rectangle(rect.Right - radius, rect.Y, radius, radius);
            Rectangle rectBottomLeft = new Rectangle(rect.X, rect.Bottom - radius, radius, radius);
            Rectangle rectBottomRight = new Rectangle(rect.Right - radius, rect.Bottom - radius, radius, radius);
            Point p1 = new Point(rect.X, rect.Y);
            Point p2 = new Point(rect.Right, rect.Y);
            Point p3 = new Point(rect.Right, rect.Bottom);
            Point p4 = new Point(rect.X, rect.Bottom);

            switch (type)
            {
                case RoundStyle.None:
                    path.AddRectangle(rect);
                    break;
                case RoundStyle.All:
                    path.AddArc(rectTopLeft, 180, 90);
                    path.AddArc(rectTopRight, 270, 90);
                    path.AddArc(rectBottomRight, 0, 90);
                    path.AddArc(rectBottomLeft, 90, 90);
                    break;
                case RoundStyle.Top:
                    path.AddArc(rectTopLeft, 180, 90);
                    path.AddArc(rectTopRight, 270, 90);
                    path.AddLine(p3, p4);
                    break;
                case RoundStyle.Bottom:
                    path.AddArc(rectBottomRight, 0, 90);
                    path.AddArc(rectBottomLeft, 90, 90);
                    path.AddLine(p1, p2);
                    break;
                case RoundStyle.Left:
                    path.AddArc(rectBottomLeft, 90, 90);
                    path.AddArc(rectTopLeft, 180, 90);
                    path.AddLine(p2, p3);
                    break;
                case RoundStyle.Right:
                    path.AddArc(rectTopRight, 270, 90);
                    path.AddArc(rectBottomRight, 0, 90);
                    path.AddLine(p4, p1);
                    break;
                default:
                    break;
            }
            path.CloseFigure();
            return path;
        }
开发者ID:webxiaohua,项目名称:SmartControls,代码行数:59,代码来源:GraphicsPathHelper.cs


示例13: CalcRoundStyle

 private static RoundStyle CalcRoundStyle(GlassPosition pos, int radius, RoundStyle ownerStyle)
 {
     if (radius < 2 || ownerStyle == RoundStyle.None)
         return RoundStyle.None;
     switch (pos)
     {
         case GlassPosition.Fill:
             return ownerStyle;
         case GlassPosition.Top:
             if (ownerStyle == RoundStyle.All || ownerStyle == RoundStyle.Top)
                 return RoundStyle.Top;
             else
                 return RoundStyle.None;
         case GlassPosition.Bottom:
             if (ownerStyle == RoundStyle.All || ownerStyle == RoundStyle.Bottom)
                 return RoundStyle.Bottom;
             else
                 return RoundStyle.None;
         case GlassPosition.Left:
             if (ownerStyle == RoundStyle.All || ownerStyle == RoundStyle.Left)
                 return RoundStyle.Left;
             else
                 return RoundStyle.None;
         case GlassPosition.Right:
             if (ownerStyle == RoundStyle.All || ownerStyle == RoundStyle.Right)
                 return RoundStyle.Right;
             else
                 return RoundStyle.None;
         default:
             return RoundStyle.None;
     }
 }
开发者ID:webxiaohua,项目名称:SmartControls,代码行数:32,代码来源:GlassPainter.cs


示例14: CreateRegion

        /// <summary>
        /// 样式绘制圆角
        /// </summary>
        /// <param name="hWnd">控件句柄</param>
        /// <param name="radius">圆角</param>
        /// <param name="roundStyle">圆角样式</param>
        /// <param name="redraw">是否重画</param>
        public static void CreateRegion(
            IntPtr hWnd,
            int radius,
            RoundStyle roundStyle,
            bool redraw)
        {
            RECT bounds = new RECT();
            NativeMethods.GetWindowRect(hWnd, ref bounds);

            Rectangle rect = new Rectangle(
                Point.Empty, bounds.Size);

            if (roundStyle != RoundStyle.None)
            {
                using (GraphicsPath path =
                    GraphicsPathHelper.CreatePath(
                    rect, radius, roundStyle, true))
                {
                    using (Region region = new Region(path))
                    {
                        path.Widen(Pens.White);
                        region.Union(path);
                        IntPtr hDc = NativeMethods.GetWindowDC(hWnd);
                        try
                        {
                            using (Graphics g = Graphics.FromHdc(hDc))
                            {
                                NativeMethods.SetWindowRgn(hWnd, region.GetHrgn(g), redraw);
                            }
                        }
                        finally
                        {
                            NativeMethods.ReleaseDC(hWnd, hDc);
                        }
                    }
                }
            }
            else
            {
                IntPtr hRgn = NativeMethods.CreateRectRgn(0, 0, rect.Width, rect.Height);
                NativeMethods.SetWindowRgn(hWnd, hRgn, redraw);
            }
        }
开发者ID:panshuiqing,项目名称:winform-ui,代码行数:50,代码来源:SkinTools.cs


示例15: CreateRegion

 public static void CreateRegion(Control control, Rectangle bounds, int radius, RoundStyle roundStyle)
 {
     using (GraphicsPath path = CreatePath(bounds, radius, roundStyle, true))
     {
         Region region = new Region(path);
         path.Widen(Pens.White);
         region.Union(path);
         control.Region = region;
     }
 }
开发者ID:weitaoxiao,项目名称:ClientEngine,代码行数:10,代码来源:GraphicUtils.cs


示例16: DrawBorder

 private void DrawBorder(Graphics g, Rectangle rect, RoundStyle roundStyle, int radius, CCSkinMain frm)
 {
     g.SmoothingMode = SmoothingMode.HighQuality;
     rect.Width--;
     rect.Height--;
     using (GraphicsPath path = GraphicsPathHelper.CreatePath(rect, radius, roundStyle, false))
     {
         using (Pen pen = new Pen(this.ColorTable.Border))
         {
             g.DrawPath(pen, path);
         }
     }
     rect.Inflate(-1, -1);
     using (GraphicsPath path = GraphicsPathHelper.CreatePath(rect, radius, roundStyle, false))
     {
         using (Pen pen = new Pen(this.ColorTable.InnerBorder))
         {
             g.DrawPath(pen, path);
         }
     }
 }
开发者ID:zhushengwen,项目名称:example-zhushengwen,代码行数:21,代码来源:SkinFormProfessionalRenderer.cs


示例17: RenderBackgroundInternal

 internal void RenderBackgroundInternal(Graphics g, Rectangle rect, Color baseColor, Color borderColor, Color innerBorderColor, RoundStyle style, int roundWidth, float basePosition, bool drawBorder, bool drawGlass, LinearGradientMode mode)
 {
     if (drawBorder)
     {
         rect.Width--;
         rect.Height--;
     }
     if ((rect.Width > 0) && (rect.Height > 0))
     {
         using (LinearGradientBrush brush = new LinearGradientBrush(rect, Color.Transparent, Color.Transparent, mode))
         {
             Rectangle rectangle;
             SolidBrush brush2;
             RectangleF ef;
             Pen pen;
             Color[] colorArray = new Color[] { this.GetColor(baseColor, 0, 0x23, 0x18, 9), this.GetColor(baseColor, 0, 13, 8, 3), baseColor, this.GetColor(baseColor, 0, 0x44, 0x45, 0x36) };
             ColorBlend blend = new ColorBlend();
             float[] numArray = new float[4];
             numArray[1] = basePosition;
             numArray[2] = basePosition + 0.05f;
             numArray[3] = 1f;
             blend.Positions = numArray;
             blend.Colors = colorArray;
             brush.InterpolationColors = blend;
             if (style != RoundStyle.None)
             {
                 GraphicsPath path;
                 using (path = GraphicsPathHelper.CreatePath(rect, roundWidth, style, false))
                 {
                     g.FillPath(brush, path);
                 }
                 if (baseColor.A > 80)
                 {
                     rectangle = rect;
                     if (mode == LinearGradientMode.Vertical)
                     {
                         rectangle.Height = (int) (rectangle.Height * basePosition);
                     }
                     else
                     {
                         rectangle.Width = (int) (rect.Width * basePosition);
                     }
                     using (GraphicsPath path2 = GraphicsPathHelper.CreatePath(rectangle, roundWidth, RoundStyle.Top, false))
                     {
                         using (brush2 = new SolidBrush(Color.FromArgb(80, 0xff, 0xff, 0xff)))
                         {
                             g.FillPath(brush2, path2);
                         }
                     }
                 }
                 if (drawGlass)
                 {
                     ef = rect;
                     if (mode == LinearGradientMode.Vertical)
                     {
                         ef.Y = rect.Y + (rect.Height * basePosition);
                         ef.Height = (rect.Height - (rect.Height * basePosition)) * 2f;
                     }
                     else
                     {
                         ef.X = rect.X + (rect.Width * basePosition);
                         ef.Width = (rect.Width - (rect.Width * basePosition)) * 2f;
                     }
                     this.DrawGlass(g, ef, 170, 0);
                 }
                 if (drawBorder)
                 {
                     using (path = GraphicsPathHelper.CreatePath(rect, roundWidth, style, false))
                     {
                         using (pen = new Pen(borderColor))
                         {
                             g.DrawPath(pen, path);
                         }
                     }
                     rect.Inflate(-1, -1);
                     using (path = GraphicsPathHelper.CreatePath(rect, roundWidth, style, false))
                     {
                         using (pen = new Pen(innerBorderColor))
                         {
                             g.DrawPath(pen, path);
                         }
                     }
                 }
             }
             else
             {
                 g.FillRectangle(brush, rect);
                 if (baseColor.A > 80)
                 {
                     rectangle = rect;
                     if (mode == LinearGradientMode.Vertical)
                     {
                         rectangle.Height = (int) (rectangle.Height * basePosition);
                     }
                     else
                     {
                         rectangle.Width = (int) (rect.Width * basePosition);
                     }
                     using (brush2 = new SolidBrush(Color.FromArgb(80, 0xff, 0xff, 0xff)))
                     {
//.........这里部分代码省略.........
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:101,代码来源:FileTransfersItem.cs


示例18: CreatePathHalf

        /// <summary>
        /// 建立带有圆角样式的路径。取横向一半顶部(用于按钮玻璃效果)
        /// </summary>
        /// <param name="rect">用来建立路径的矩形。</param>
        /// <param name="_radius">圆角的大小。</param>
        /// <param name="style">圆角的样式。</param>
        /// <param name="correction">是否把矩形长宽减 1,以便画出边框。</param>
        /// <returns>建立的路径。</returns>
        public static GraphicsPath CreatePathHalf(
            Rectangle rect, int radius, RoundStyle style, bool correction)
        {
            GraphicsPath path = new GraphicsPath();
            int radiusCorrection = correction ? 1 : 0;
            switch (style)
            {
                case RoundStyle.None:
                    path.AddRectangle(new Rectangle(rect.X, rect.Y, rect.Width - radiusCorrection, rect.Height/2 - radiusCorrection));
                    break;
                case RoundStyle.All:
                    //顺时针
                    path.AddArc(rect.X, rect.Y, radius, radius, 180, 90);

                    path.AddArc(
                        rect.Right - radius - radiusCorrection,
                        rect.Y,
                        radius,
                        radius,
                        270,
                        90);
                    path.AddLine(rect.Right - radiusCorrection,
                        rect.Y + rect.Height / 2 - radiusCorrection,
                        rect.X,
                        rect.Y + rect.Height / 2 - radiusCorrection);

                   
                    break;
                case RoundStyle.Left:
                    path.AddArc(rect.X, rect.Y, radius, radius, 180, 90);

                    path.AddLine(
                        rect.Right - radiusCorrection, rect.Y,
                        rect.Right - radiusCorrection, rect.Y + rect.Height / 2 - radiusCorrection);
                    path.AddLine(                        
                        rect.Right - radiusCorrection, rect.Y + rect.Height / 2 - radiusCorrection,
                        rect.X, rect.Y + rect.Height / 2 - radiusCorrection);
                    
                    break;
                case RoundStyle.Right:
                    path.AddArc(
                        rect.Right - radius - radiusCorrection,
                        rect.Y,
                        radius,
                        radius,
                        270,
                        90);
                    path.AddLine(rect.Right - radiusCorrection, rect.Y + rect.Height / 2 - radiusCorrection,
                        rect.X, rect.Y + rect.Height / 2 - radiusCorrection);
                    path.AddLine(rect.X, rect.Y + rect.Height / 2 - radiusCorrection, 
                        rect.X, rect.Y);
                    break;
                case RoundStyle.Top:
                    path.AddArc(rect.X, rect.Y, radius, radius, 180, 90);
                    path.AddArc(
                        rect.Right - radius - radiusCorrection,
                        rect.Y,
                        radius,
                        radius,
                        270,
                        90);
                    path.AddLine(
                        rect.Right - radiusCorrection, rect.Y + rect.Height / 2 - radiusCorrection,
                        rect.X, rect.Y + rect.Height / 2 - radiusCorrection);
                    break;
                case RoundStyle.Bottom:
                    path.AddRectangle(new Rectangle(rect.X, rect.Y, rect.Width - radiusCorrection, rect.Height / 2 - radiusCorrection));

                    break;
            }
            path.CloseFigure();

            return path;
        }
开发者ID:JackWangCUMT,项目名称:winform-control-lib,代码行数:82,代码来源:GraphicsPathHelper.cs


示例19: RenderBackgroundInternal

        internal static void RenderBackgroundInternal(
           Graphics g,
           Rectangle rect,
           Color baseColor,
           Color borderColor,
           Color innerBorderColor,
           RoundStyle style,
           int roundWidth,
           float basePosition,
           bool drawBorder,
           bool drawGlass,
           LinearGradientMode mode)
        {
            if (drawBorder)
            {
                rect.Width--;
                rect.Height--;
            }

            if (rect.Width == 0 || rect.Height == 0)
            {
                return;
            }

            using (LinearGradientBrush brush = new LinearGradientBrush(
                rect, Color.Transparent, Color.Transparent, mode))
            {
                Color[] colors = new Color[4];
                colors[0] = GetColor(baseColor, 0, 35, 24, 9);
                colors[1] = GetColor(baseColor, 0, 13, 8, 3);
                colors[2] = baseColor;
                colors[3] = GetColor(baseColor, 0, 35, 24, 9);

                ColorBlend blend = new ColorBlend();
                blend.Positions = new float[] { 0.0f, basePosition, basePosition + 0.05f, 1.0f };
                blend.Colors = colors;
                brush.InterpolationColors = blend;
                if (style != RoundStyle.None)
                {
                    using (GraphicsPath path =
                        GraphicsPathHelper.CreatePath(rect, roundWidth, style, false))
                    {
                        g.FillPath(brush, path);
                    }

                    if (baseColor.A > 80)
                    {
                        Rectangle rectTop = rect;

                        if (mode == LinearGradientMode.Vertical)
                        {
                            rectTop.Height = (int)(rectTop.Height * basePosition);
                        }
                        else
                        {
                            rectTop.Width = (int)(rect.Width * basePosition);
                        }
                        using (GraphicsPath pathTop = GraphicsPathHelper.CreatePath(
                            rectTop, roundWidth, RoundStyle.Top, false))
                        {
                            using (SolidBrush brushAlpha =
                                new SolidBrush(Color.FromArgb(128, 255, 255, 255)))
                            {
                                g.FillPath(brushAlpha, pathTop);
                            }
                        }
                    }

                    if (drawGlass)
                    {
                        RectangleF glassRect = rect;
                        if (mode == LinearGradientMode.Vertical)
                        {
                            glassRect.Y = rect.Y + rect.Height * basePosition;
                            glassRect.Height = (rect.Height - rect.Height * basePosition) * 2;
                        }
                        else
                        {
                            glassRect.X = rect.X + rect.Width * basePosition;
                            glassRect.Width = (rect.Width - rect.Width * basePosition) * 2;
                        }
                        ControlPaintEx.DrawGlass(g, glassRect, 170, 0);
                    }

                    if (drawBorder)
                    {
                        using (GraphicsPath path =
                            GraphicsPathHelper.CreatePath(rect, roundWidth, style, false))
                        {
                            using (Pen pen = new Pen(borderColor))
                            {
                                g.DrawPath(pen, path);
                            }
                        }

                        rect.Inflate(-1, -1);
                        using (GraphicsPath path =
                            GraphicsPathHelper.CreatePath(rect, roundWidth, style, false))
                        {
                            using (Pen pen = new Pen(innerBorderColor))
//.........这里部分代码省略.........
开发者ID:piaolingzxh,项目名称:Justin,代码行数:101,代码来源:RenderHelper.cs


示例20: DrawGradientRoundRect

        internal static void DrawGradientRoundRect(
            Graphics g,
            Rectangle rect,
            Color begin,
            Color end,
            Color border,
            Color innerBorder,
            Blend blend,
            LinearGradientMode mode,
            int radios,
            RoundStyle roundStyle,
            bool drawBorder,
            bool drawInnderBorder)
        {
            using (GraphicsPath path = GraphicsPathHelper.CreatePath(
                rect, radios, roundStyle, true))
            {
                using (LinearGradientBrush brush = new LinearGradientBrush(
                      rect, begin, end, mode))
                {
                    brush.Blend = blend;
                    g.FillPath(brush, path);
                }

                if (drawBorder)
                {
                    using (Pen pen = new Pen(border))
                    {
                        g.DrawPath(pen, path);
                    }
                }
            }

            if (drawInnderBorder)
            {
                rect.Inflate(-1, -1);
                using (GraphicsPath path = GraphicsPathHelper.CreatePath(
                    rect, radios, roundStyle, true))
                {
                    using (Pen pen = new Pen(innerBorder))
                    {
                        g.DrawPath(pen, path);
                    }
                }
            }
        }
开发者ID:piaolingzxh,项目名称:Justin,代码行数:46,代码来源:ControlPaintEx.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RoundZone类代码示例发布时间:2022-05-24
下一篇:
C# Rotation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap