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


C# LinearGradientBrush.SetSigmaBellShape方法代码示例

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


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

示例1: CreateGreyscale

 public void CreateGreyscale()
 {
     using (Bitmap b = new Bitmap(100, 100))
     {
         using (Graphics g = b.GetGraphics())
         {
             using (LinearGradientBrush brush = new LinearGradientBrush(
               new Rectangle(0, 0, 100, 100),
               Color.Blue,
               Color.Red,
               LinearGradientMode.Vertical))
             {
                 brush.SetSigmaBellShape(0.5f);
                 g.FillRectangle(brush, new Rectangle(0, 0, 100, 100));
                 using (Bitmap b2 = (Bitmap)b.CreateGreyscale())
                 {
                     if (ShowTestForm(b2) != DialogResult.OK)
                     {
                         Assert.Fail();
                     }
                 }
             }
         }
     }
 }
开发者ID:TGOSeraph,项目名称:StUtil,代码行数:25,代码来源:ImageTests.cs

示例2: AboutForm_Paint

 private void AboutForm_Paint(object sender, PaintEventArgs e)
 {
     Graphics g = e.Graphics;
     Rectangle rect = new Rectangle(0, 0, this.ClientSize.Width, this.ClientSize.Height);
     using (LinearGradientBrush brush = new LinearGradientBrush(rect, Color.Black, Color.FromArgb(50, 50, 50), LinearGradientMode.Vertical))
     {
         brush.SetSigmaBellShape(0.25f);
         g.FillRectangle(brush, rect);
     }
 }
开发者ID:Jaex,项目名称:SMBStats,代码行数:10,代码来源:AboutForm.cs

示例3: Draw

        public void Draw(System.Drawing.Graphics graphics, System.Drawing.Rectangle bounds)
        {
            float length = (float)this.manager.Progress / 100.0f;

			using (LinearGradientBrush complete = new LinearGradientBrush(bounds, Color.LightBlue, Color.Blue, LinearGradientMode.Horizontal))
            using (SolidBrush incomplete = new SolidBrush(Color.White))
            using(StringFormat format = new StringFormat())
            using(SolidBrush text = new SolidBrush(Color.Black))
            {
				complete.SetSigmaBellShape(1.0f, 0.25f);
                format.Alignment = StringAlignment.Center;
				graphics.FillRectangle(complete, bounds.X, bounds.Y + borderHeight, bounds.Width * length, bounds.Height - 2 * borderHeight);
				graphics.FillRectangle(incomplete, bounds.X + (bounds.Width * length), bounds.Y + borderHeight, bounds.Width - bounds.Width * length, bounds.Height - 2 * borderHeight);
                graphics.DrawString(string.Format("{0:0.00} %",this.manager.Progress), new Font(FontFamily.GenericSansSerif, 7), text, bounds, format); 
            }
        }
开发者ID:AssassinUKG,项目名称:monotorrent,代码行数:16,代码来源:TorrentProgressBar.cs

示例4: Draw

        public void Draw(System.Drawing.Graphics graphics, System.Drawing.Rectangle bounds)
        {
            float width = (float)bounds.Width / args.Piece.BlockCount;
            RectangleF brushDimensions = new RectangleF(0, 0, width, bounds.Height);
            using (LinearGradientBrush requestedBrush = new LinearGradientBrush(brushDimensions, Color.LightBlue, Color.Blue, LinearGradientMode.Vertical))
            using (LinearGradientBrush receivedBrush = new LinearGradientBrush(brushDimensions, Color.LightGoldenrodYellow, Color.Goldenrod, LinearGradientMode.Vertical))
            using (LinearGradientBrush writtenBrush = new LinearGradientBrush(brushDimensions, Color.LightGreen, Color.LimeGreen, LinearGradientMode.Vertical))
            using (LinearGradientBrush notRequestedBrush = new LinearGradientBrush(brushDimensions, Color.LightSalmon, Color.Red, LinearGradientMode.Vertical))
            using (LinearGradientBrush pendingHashCheck = new LinearGradientBrush(brushDimensions, Color.BurlyWood, Color.Brown, LinearGradientMode.Vertical))
            {
                requestedBrush.SetSigmaBellShape(0.25f);
                receivedBrush.SetSigmaBellShape(0.25f);
                writtenBrush.SetSigmaBellShape(0.25f);
                notRequestedBrush.SetSigmaBellShape(0.25f);
                pendingHashCheck.SetSigmaBellShape(0.25f);

                Rectangle rect = bounds;
                
                for (int i = 0; i < this.args.Piece.BlockCount; i++)
                {
                    RectangleF newArea = new RectangleF(rect.X + (width * i), rect.Y + borderHeight, width, rect.Height - 2 * borderHeight);
                    if (this.args.Piece.AllBlocksReceived)
                        graphics.FillRectangle(pendingHashCheck, newArea);

                    else if (args.Piece[i].Written)
                        graphics.FillRectangle(writtenBrush, newArea);

                    else if (args.Piece[i].Received)
                        graphics.FillRectangle(receivedBrush, newArea);

                    else if (args.Piece[i].Requested)
                        graphics.FillRectangle(requestedBrush, newArea);

                    else
                        graphics.FillRectangle(notRequestedBrush, newArea);
                }
            }
        }
开发者ID:AssassinUKG,项目名称:monotorrent,代码行数:38,代码来源:BlockProgressBar.cs

示例5: DrawOuterGradient

        /// <summary>
        /// Draws a gradient around the specified polygon. Fades from 'inner' to 'outer' over a distance of 'width' pixels. 
        /// </summary>
        /// <param name="g"></param>
        /// <param name="poly"></param>
        /// <param name="inner"></param>
        /// <param name="outer"></param>
        /// <param name="width"></param>
        public static void DrawOuterGradient(Graphics g, PointF[] poly, Color inner, Color outer, float width)
        {
            PointF[,] corners = PolygonMath.GetCorners(poly, width);
            PointF[,] sides = PolygonMath.GetSides(poly, width);
            //Overlapping these causes darker areas... Dont use InflatePoly

            //Paint corners
            for (int i = 0; i <= corners.GetUpperBound(0); i++) {
                PointF[] pts = PolygonMath.GetSubArray(corners, i);
                using (Brush b = PolygonMath.GenerateRadialBrush(inner, outer, pts[0], width + 1)) {
                    g.FillPolygon(b, pts);
                }
            }
            //Paint sides
            for (int i = 0; i <= sides.GetUpperBound(0); i++) {
                PointF[] pts = PolygonMath.GetSubArray(sides, i);
                using (LinearGradientBrush b = new LinearGradientBrush(pts[3], pts[0], inner, outer)) {
                    b.SetSigmaBellShape(1);
                    b.WrapMode = WrapMode.TileFlipXY;
                    g.FillPolygon(b, pts);
                }
            }
        }
开发者ID:stukalin,项目名称:ImageResizer,代码行数:31,代码来源:DropShadow.cs

示例6: PaintView13

 void PaintView13(Graphics g)
 {
     // Create a rectangle
     Rectangle rect = new Rectangle(0, 0, 40, 20);
     // Create a linear gradient brush
     LinearGradientBrush rgBrush =
         new LinearGradientBrush(
             rect, Color.Black, Color.Blue,
             0.0f, true);
     // Fill rectangle
     g.FillRectangle(rgBrush,
                     new Rectangle(10, 10, 300, 100));
     // Set sigma bell shape
     rgBrush.SetSigmaBellShape(0.8f, 1.0f);
     // Fill rectangle again
     g.FillRectangle(rgBrush,
                     new Rectangle(10, 120, 300, 100));
     // Set blend triangular shape
     rgBrush.SetBlendTriangularShape(0.2f, 1.0f);
     // Fill rectangle again
     g.FillRectangle(rgBrush,
                     new Rectangle(10, 240, 300, 100));
 }
开发者ID:asfungithub,项目名称:sysdrawing-coregraphics,代码行数:23,代码来源:DrawingView.cs

示例7: DrawRibbonGroupSeparator

        /// <summary>
        /// Perform drawing of a ribbon group separator.
        /// </summary>
        /// <param name="shape">Ribbon shape.</param>
        /// <param name="context">Render context.</param>
        /// <param name="displayRect">Display area available for drawing.</param>
        /// <param name="paletteGeneral">General ribbon palette details.</param>
        /// <param name="state">State associated with rendering.</param>
        public override void DrawRibbonGroupSeparator(PaletteRibbonShape shape,
                                                      RenderContext context,
                                                      Rectangle displayRect,
                                                      IPaletteRibbonGeneral paletteGeneral,
                                                      PaletteState state)
        {
            Debug.Assert(context != null);
            Debug.Assert(paletteGeneral != null);

            // Validate parameter references
            if (context == null) throw new ArgumentNullException("context");
            if (paletteGeneral == null) throw new ArgumentNullException("paletteGeneral");

            int x = displayRect.X + (displayRect.Width - 2) / 2;
            Color darkColor = paletteGeneral.GetRibbonGroupSeparatorDark(state);
            Color lightColor = paletteGeneral.GetRibbonGroupSeparatorLight(state);

            switch (shape)
            {
                default:
                case PaletteRibbonShape.Office2007:
                    using (Pen darkPen = new Pen(darkColor),
                               lightPen = new Pen(lightColor))
                    {
                        context.Graphics.DrawLine(lightPen, x, displayRect.Top + 2, x, displayRect.Bottom - 3);
                        context.Graphics.DrawLine(darkPen, x + 1, displayRect.Top + 2, x + 1, displayRect.Bottom - 3);
                    }
                    break;
                case PaletteRibbonShape.Office2010:
                    using (LinearGradientBrush darkBrush = new LinearGradientBrush(new RectangleF(displayRect.X, displayRect.Y - 1, displayRect.Width, displayRect.Height + 2), Color.FromArgb(72, darkColor), darkColor, 90f),
                                               lightBrush = new LinearGradientBrush(new RectangleF(displayRect.X - 1, displayRect.Y - 1, displayRect.Width + 2, displayRect.Height + 2), Color.FromArgb(128, lightColor), lightColor, 90f))
                    {
                        darkBrush.SetSigmaBellShape(0.5f);
                        lightBrush.SetSigmaBellShape(0.5f);

                        using (Pen darkPen = new Pen(darkBrush))
                        {
                            context.Graphics.FillRectangle(lightBrush, x, displayRect.Top, 3, displayRect.Height);
                            context.Graphics.DrawLine(darkPen, x + 1, displayRect.Top, x + 1, displayRect.Bottom - 1);
                        }
                    }
                    break;
            }
        }
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:52,代码来源:RenderStandard.cs

示例8: DrawGradientToolSplitItem

        private void DrawGradientToolSplitItem(Graphics g,
                                               ToolStripSplitButton splitButton,
                                               GradientItemColors colorsButton,
                                               GradientItemColors colorsDrop,
                                               GradientItemColors colorsSplit)
        {
            // Create entire area and just the drop button area rectangles
            Rectangle backRect = new Rectangle(Point.Empty, splitButton.Bounds.Size);
            Rectangle backRectDrop = splitButton.DropDownButtonBounds;

            // Cannot paint zero sized areas
            if ((backRect.Width > 0) && (backRectDrop.Width > 0) &&
                (backRect.Height > 0) && (backRectDrop.Height > 0))
            {
                // Area that is the normal button starts as everything
                Rectangle backRectButton = backRect;

                // The X offset to draw the split line
                int splitOffset;

                // Is the drop button on the right hand side of entire area?
                if (backRectDrop.X > 0)
                {
                    backRectButton.Width = backRectDrop.Left;
                    backRectDrop.X -= 1;
                    backRectDrop.Width++;
                    splitOffset = backRectDrop.X;
                }
                else
                {
                    backRectButton.Width -= backRectDrop.Width - 2;
                    backRectButton.X = backRectDrop.Right - 1;
                    backRectDrop.Width++;
                    splitOffset = backRectDrop.Right - 1;
                }

                // Create border path around the item
                using (GraphicsPath borderPath = this.CreateBorderPath(backRect, _cutMenuItemBack))
                {
                    // Draw the normal button area background
                    this.DrawGradientBack(g, backRectButton, colorsButton);

                    // Draw the drop button area background
                    this.DrawGradientBack(g, backRectDrop, colorsDrop);

                    // Draw the split line between the areas
                    using (
                        LinearGradientBrush splitBrush =
                            new LinearGradientBrush(
                                new Rectangle(backRect.X + splitOffset, backRect.Top, 1, backRect.Height + 1),
                                colorsSplit.Border1, colorsSplit.Border2, 90f))
                    {
                        // Sigma curve, so go from color1 to color2 and back to color1 again
                        splitBrush.SetSigmaBellShape(0.5f);

                        // Convert the brush to a pen for DrawPath call
                        using (Pen splitPen = new Pen(splitBrush))
                            g.DrawLine(splitPen, backRect.X + splitOffset, backRect.Top + 1, backRect.X + splitOffset,
                                       backRect.Bottom - 1);
                    }

                    // Draw the border of the entire item
                    this.DrawGradientBorder(g, backRect, colorsButton);
                }
            }
        }
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:66,代码来源:Office2007Renderer.cs

示例9: GetReflectedBrush

 /// <summary>
 /// Creates a LinearGradientBrush object.
 /// </summary>
 /// <param name="path">The graphics path used to construct the brush.</param>
 /// <param name="angle">The gradient angle.</param>
 /// <param name="focus">The focus for the SigmaBellShape.</param>
 /// <param name="scale">The scale for the SigmaBellShape.</param>
 public LinearGradientBrush GetReflectedBrush(GraphicsPath path, int angle, float focus, float scale)
 {
     LinearGradientBrush brush = new LinearGradientBrush(path.GetBounds(), _Color1, _Color2, angle, false);
     brush.SetSigmaBellShape(focus, scale);
     return brush;
 }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:13,代码来源:ColorData.cs

示例10: drawLinearGradient

 private void drawLinearGradient(Rectangle rDmn, IntPtr hdc, LinearGradientMode m)
 {
     Graphics g = Graphics.FromHdc(hdc);
     float o = _fOpacity * 255;
     Color c1 = Color.FromArgb((int)o, _oGradientStartColor);
     Color c2 = Color.FromArgb((int)o, _oGradientEndColor);
     LinearGradientBrush hB = new LinearGradientBrush(
         rDmn,
         c1,
         c2,
         m);
     switch (_eGradientStyle)
     {
         case GradientStyle.VerticalTube:
             hB.SetBlendTriangularShape(.5f, 1.0f);
             g.FillRectangle(hB, rDmn);
             break;
         case GradientStyle.HorizontalTube:
             hB.SetBlendTriangularShape(.5f, 1.0f);
             g.FillRectangle(hB, rDmn);
             break;
         case GradientStyle.SigmaBellShape:
             hB.SetSigmaBellShape(.5f, 1.0f);
             g.FillRectangle(hB, rDmn);
             break;
         default:
             g.FillRectangle(hB, rDmn);
             break;
     }
     hB.Dispose();
     g.Dispose();
 }
开发者ID:JackWangCUMT,项目名称:winform-control-lib,代码行数:32,代码来源:WSNToolTip.cs

示例11: OnDrawItem

    protected override void OnDrawItem(DrawItemEventArgs e)
    {
      Graphics grfx = e.Graphics;
      Rectangle rectColor = new Rectangle(e.Bounds.Left, e.Bounds.Top, 2 * e.Bounds.Height, e.Bounds.Height);
      rectColor.Inflate(-1, -1);

      Rectangle rectText = new Rectangle(e.Bounds.Left + 2 * e.Bounds.Height,
        e.Bounds.Top,
        e.Bounds.Width - 2 * e.Bounds.Height,
        e.Bounds.Height);

      if (this.Enabled)
        e.DrawBackground();

      LinearGradientShape item = e.Index >= 0 ? (LinearGradientShape)Items[e.Index] : LinearGradientShape.Linear;

      Rectangle rectShape = new Rectangle(rectColor.X + rectColor.Width / 4, rectColor.Y, rectColor.Width / 2, rectColor.Height);
      using (LinearGradientBrush br = new LinearGradientBrush(rectShape, e.ForeColor, e.BackColor, LinearGradientMode.Horizontal))
      {
        if (item == LinearGradientShape.Triangular)
          br.SetBlendTriangularShape(0.5f);
        else if (item == LinearGradientShape.SigmaBell)
          br.SetSigmaBellShape(0.5f);

        grfx.FillRectangle(br, rectColor);
      }
      SolidBrush foreColorBrush = new SolidBrush(e.ForeColor);
      grfx.DrawString(item.ToString(), Font, foreColorBrush, rectText);
    }
开发者ID:Altaxo,项目名称:Altaxo,代码行数:29,代码来源:LinearGradientShapeComboBox.cs

示例12: DrawBack

            public override void DrawBack(Graphics g, Rectangle rect)
            {
                Rectangle inset = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
                Rectangle insetB = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3);
                Rectangle insetC = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);

                using (LinearGradientBrush insideBrush1 = new LinearGradientBrush(rect, Back1B, Back1, 90f),
                                           insideBrush2 = new LinearGradientBrush(insetB, Back2B, Back2, 90f))
                {
                    insideBrush1.SetSigmaBellShape(0.5f);
                    insideBrush2.SetSigmaBellShape(0.5f);

                    g.FillRectangle(insideBrush1, inset);
                    using (GraphicsPath borderPath = CreateBorderPath(insetC, _cutInnerItemMenu),
                                        clipPath = CreateBorderPath(insetB, _cutInnerItemMenu))
                    {
                        using (Pen insidePen = new Pen(insideBrush2))
                            g.DrawPath(insidePen, borderPath);

                        g.FillPath(insideBrush2, borderPath);

                        using (Clipping clipping = new Clipping(g, clipPath))
                        {
                            using (GraphicsPath ellipsePath = new GraphicsPath())
                            {
                                RectangleF ellipseRect = new RectangleF(-(rect.Width / 2), rect.Bottom - 9, rect.Width * 2, 18);
                                PointF ellipseCenter = new PointF(ellipseRect.Left + (ellipseRect.Width / 2), ellipseRect.Top + (ellipseRect.Height / 2));
                                ellipsePath.AddEllipse(ellipseRect);

                                using (PathGradientBrush insideLighten = new PathGradientBrush(ellipsePath))
                                {
                                    insideLighten.CenterPoint = ellipseCenter;
                                    insideLighten.CenterColor = Color.White;
                                    insideLighten.SurroundColors = new Color[] { Color.Transparent };
                                    g.FillPath(insideLighten, ellipsePath);
                                }
                            }
                        }
                    }
                }
            }
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:41,代码来源:KryptonOffice2013Renderer.cs

示例13: createMacStyleButton

        private void createMacStyleButton(Color clrStartUp, Color clrEndUp, Color clrBorder, Graphics g)
        {
            GraphicsPath btn = new GraphicsPath();

            //Rectangle rcBtn = new Rectangle(m_lLeft, m_lTop, m_lButtonWidth, m_lButtonHeight);

            int l = m_lLeft + m_lButtonWidth / 4;
            int t = m_lTop + m_lButtonHeight / 4;
            int w = m_lButtonWidth / 2;
            int h = m_lButtonHeight / 2;
            Rectangle rcBtn = new Rectangle(l, t, w, h);
            btn.AddEllipse(rcBtn);

            // fill button:
            using (LinearGradientBrush aquaUp = new LinearGradientBrush(rcBtn, clrStartUp, clrEndUp, LinearGradientMode.Vertical))
            {
                aquaUp.SetSigmaBellShape(1.0f);
                g.FillPath(aquaUp, btn);
                using (Pen border = new Pen(clrBorder))
                {
                    g.DrawPath(border, btn);
                }

                #region Outer border

                // This will give very cool shadow drop effect to the button:
                Rectangle rcOuterBorder = rcBtn;
                rcOuterBorder.Inflate(1, 1);
                using (GraphicsPath ob = new GraphicsPath())
                {
                    ob.AddEllipse(rcOuterBorder);
                    using (Pen po = new Pen(Color.FromArgb(205, 205, 205)))
                    {
                        g.DrawPath(po, ob);
                    }
                }

                #endregion
            }
            // draw upper glow:
            Rectangle rcGlow = new Rectangle(rcBtn.Left + rcBtn.Width / 2 - 1, rcBtn.Top + 1, 3, 2);
            using (SolidBrush sb = new SolidBrush(Color.FromArgb(200, Color.White)))
            {
                g.FillRectangle(sb, rcGlow);
            }
            // draw button symbol:
            if (m_bHovering)
            {
                switch (m_eButtonType)
                {
                    case ECtrlType.Close:
                        using (Pen pClose = new Pen(Color.FromArgb(146, 57, 46)))
                        {
                            pClose.Width = 1.55f;
                            g.DrawLine(pClose, rcBtn.Left + 4, rcBtn.Top + 4, rcBtn.Right - 4, rcBtn.Bottom - 4);
                            g.DrawLine(pClose, rcBtn.Right - 4, rcBtn.Top + 4, rcBtn.Left + 4, rcBtn.Bottom - 4);
                        }
                        break;

                    case ECtrlType.Maximize:
                        using (Pen pMaximize = new Pen(Color.FromArgb(162, 95, 59)))
                        {
                            pMaximize.Width = 1.55f;
                            Rectangle rcMax = rcBtn;
                            rcMax.Inflate(-4, -4);
                            g.DrawRectangle(pMaximize, rcMax);
                        }
                        break;

                    case ECtrlType.Minimize:
                        using (Pen pMinimize = new Pen(Color.FromArgb(81, 120, 47)))
                        {
                            pMinimize.Width = 1.55f;
                            g.DrawLine(pMinimize, rcBtn.Left + 4, rcBtn.Bottom - 4, rcBtn.Right - 4, rcBtn.Bottom - 4);
                        }
                        break;
                }
                // fill lower glow:
                using (GraphicsPath shn = new GraphicsPath())
                {
                    shn.AddEllipse(rcBtn.Left, rcBtn.Top + rcBtn.Height / 2, rcBtn.Width, rcBtn.Height);
                    using (PathGradientBrush pgb = new PathGradientBrush(shn))
                    {
                        g.SetClip(btn);
                        pgb.CenterColor = Color.FromArgb(210, Color.White);
                        pgb.SurroundColors = new Color[] { Color.FromArgb(0, clrEndUp) };
                        if (m_bHovering)
                        {
                            g.FillPath(pgb, shn);
                        }
                        g.ResetClip();
                    }
                }
            }
            btn.Dispose();
        }
开发者ID:Egoily,项目名称:CSharp-EAlbum,代码行数:96,代码来源:EFormCtrlButtons.cs

示例14: DrawTab

		public static void DrawTab(Graphics g, Rectangle r, Corners corner, GradientType gradient, Color darkColor, Color lightColor, Color edgeColor, bool closed )
		{
			//dims
			Point[] points;
			GraphicsPath path;
			Region region;
			LinearGradientBrush linearBrush;
			
			Brush brush = null;
			Pen pen;
			//set brushes
			switch(gradient)
			{
				case GradientType.Flat:
					brush = new SolidBrush(darkColor);
					break;
				case GradientType.Linear:
					brush = new LinearGradientBrush(r,darkColor,lightColor,LinearGradientMode.Vertical);
					break;
				case GradientType.Bell:
					linearBrush = new LinearGradientBrush(r,darkColor,lightColor,LinearGradientMode.Vertical);
					linearBrush.SetSigmaBellShape(0.17F,0.67F);
					brush = linearBrush;
					break;
			}
			pen = new Pen(edgeColor,1);
			//generic points
			points = new Point[12]
								{
									new Point(r.Left,r.Bottom), //0
									new Point(r.Left, r.Bottom-bshift), //1
									new Point(r.Left,r.Top+bshift), //2
									new Point(r.Left,r.Top), //3
									new Point(r.Left+bshift,r.Top), //4
									new Point(r.Right-bshift,r.Top), //5
									new Point(r.Right,r.Top), //6
									new Point(r.Right,r.Top+bshift), //7
									new Point(r.Right,r.Bottom-bshift), //8
									new Point(r.Right,r.Bottom), //9
									new Point(r.Right-bshift,r.Bottom), //10									  
									new Point(r.Left+bshift,r.Bottom) //10
								};
			path = new GraphicsPath();
			switch(corner)
			{
				case Corners.LB:

					path.AddLine(points[3],points[1]);
					path.AddBezier(points[1],points[0],points[0],points[11]);	
					path.AddLine(points[11],points[9]);					
					path.AddLine(points[9],points[6]);
					path.AddLine(points[6],points[3]);
					region = new Region(path);
					g.FillRegion(brush,region);

					g.DrawLine(pen,points[3],points[1]);
					g.DrawBezier(pen,points[1],points[0],points[0],points[11]);	
					g.DrawLine(pen,points[11],points[9]);					
					g.DrawLine(pen,points[9],points[6]);
					if(closed)
						g.DrawLine(pen,points[6],points[3]);
					break;
				case Corners.LT:
					path.AddLine(points[0],points[2]);
					path.AddBezier(points[2],points[3],points[3],points[4]);
					path.AddLine(points[4],points[6]);						
					path.AddLine(points[6],points[9]);
					path.AddLine(points[9],points[0]);
					region = new Region(path);
					g.FillRegion(brush,region);

					g.DrawLine(pen,points[0],points[2]);
					g.DrawBezier(pen,points[2],points[3],points[3],points[4]);	
					g.DrawLine(pen,points[4],points[6]);					
					g.DrawLine(pen,points[6],points[9]);
					if(closed)
						g.DrawLine(pen,points[9],points[0]);
					break;
				case Corners.RB:
					path.AddLine(points[3],points[0]);
					path.AddLine(points[0],points[10]);
					path.AddBezier(points[10],points[9],points[9],points[8]);	
					path.AddLine(points[8],points[6]);
					path.AddLine(points[6],points[3]);
					region = new Region(path);
					g.FillRegion(brush,region);

					g.DrawLine(pen,points[3],points[0]);
					g.DrawLine(pen,points[0],points[10]);
					g.DrawBezier(pen,points[10],points[9],points[9],points[8]);	
					g.DrawLine(pen,points[8],points[6]);
					if(closed)
						g.DrawLine(pen,points[6],points[3]);
					break;
				case Corners.RT:
					path.AddLine(points[0],points[3]);
					path.AddLine(points[3],points[5]);
					path.AddBezier(points[5],points[6],points[6],points[7]);	
					path.AddLine(points[7],points[9]);
					path.AddLine(points[9],points[0]);
//.........这里部分代码省略.........
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:101,代码来源:DrawUtil.cs

示例15: DrawGradientBorder

        private static void DrawGradientBorder(Graphics g,
                                               Rectangle backRect,
                                               GradientItemColors colors)
        {
            var backRectI = backRect;
            backRectI.Inflate(1, 1);

            // Finally draw the border around the menu item
            using (var borderBrush = new LinearGradientBrush(backRectI, colors.Border1, colors.Border2, 90f))
            {
                // Sigma curve, so go from color1 to color2 and back to color1 again
                borderBrush.SetSigmaBellShape(0.5f);

                // Convert the brush to a pen for DrawPath call
                using (var borderPen = new Pen(borderBrush))
                {
                    // Create border path around the entire item
                    using (var borderPath = CreateBorderPath(backRect, _cutMenuItemBack))
                        g.DrawPath(borderPen, borderPath);
                }
            }
        }
开发者ID:AlexGaidukov,项目名称:gipertest_streaming,代码行数:22,代码来源:Office2007Renderer.cs


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