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


C# Drawing2D.ColorBlend类代码示例

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


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

示例1: DrawAquaPillSingleLayer

        /// <summary>
        /// Draws the aqua pull single layer
        /// </summary>
        /// <param name="graphicsDevice">Graphics device</param>
        /// <param name="drawRectF">Float rectangle</param>
        /// <param name="drawColor">A Color</param>
        /// <param name="orientation">Enumeration Orientation</param>
        public static void DrawAquaPillSingleLayer(Graphics graphicsDevice, RectangleF drawRectF, Color drawColor, Orientation orientation)
        {
            Color color1;
            Color color2;
            Color color3;
            Color color4;
            System.Drawing.Drawing2D.LinearGradientBrush gradientBrush;
            System.Drawing.Drawing2D.ColorBlend colorBlend = new System.Drawing.Drawing2D.ColorBlend();
            color1 = drawColor;
            color2 = ControlPaint.Light(color1);
            color3 = ControlPaint.Light(color2);
            color4 = ControlPaint.Light(color3);
            colorBlend.Colors = new Color[] { color1, color2, color3, color4 };
            colorBlend.Positions = new float[] { 0, 0.25f, 0.65f, 1 };
            if (orientation == Orientation.Horizontal)
            {
                gradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(new Point((int)drawRectF.Left, (int)drawRectF.Top), new Point((int)drawRectF.Left, (int)drawRectF.Top + (int)drawRectF.Height), color1, color4);
            }
            else
            {
                gradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(new Point((int)drawRectF.Left, (int)drawRectF.Top), new Point((int)drawRectF.Left + (int)drawRectF.Width, (int)drawRectF.Top), color1, color4);
            }

            gradientBrush.InterpolationColors = colorBlend;
            FillPill(gradientBrush, drawRectF, graphicsDevice);
        }
开发者ID:Narinyir,项目名称:DantesPlayer,代码行数:33,代码来源:DrawStyleHelper.cs

示例2: BlackStyleCheckBox

        public BlackStyleCheckBox()
        {
            SpaceAfterCheckBox = 3;

            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);

            BackColor = Color.Transparent;
            ForeColor = Color.White;

            // http://connect.microsoft.com/VisualStudio/feedback/details/348321/bug-in-fillrectangle-using-lineargradientbrush
            backgroundBrush = new LinearGradientBrush(new Rectangle(2, 2, checkBoxSize - 4, checkBoxSize - 3), Color.FromArgb(105, 105, 105), Color.FromArgb(55, 55, 55), LinearGradientMode.Vertical);

            innerBorderBrush = new LinearGradientBrush(new Rectangle(1, 1, checkBoxSize - 2, checkBoxSize - 2), Color.FromArgb(125, 125, 125), Color.FromArgb(65, 75, 75), LinearGradientMode.Vertical);
            innerBorderPen = new Pen(innerBorderBrush);

            backgroundCheckedBrush = new LinearGradientBrush(new Rectangle(2, 2, checkBoxSize - 4, checkBoxSize - 3), Color.Black, Color.Black, LinearGradientMode.Vertical);
            ColorBlend cb = new ColorBlend();
            cb.Positions = new float[] { 0, 0.49f, 0.50f, 1 };
            cb.Colors = new Color[] { Color.FromArgb(102, 163, 226), Color.FromArgb(83, 135, 186), Color.FromArgb(75, 121, 175), Color.FromArgb(56, 93, 135) };
            backgroundCheckedBrush.InterpolationColors = cb;

            innerBorderCheckedBrush = new LinearGradientBrush(new Rectangle(1, 1, checkBoxSize - 2, checkBoxSize - 2), Color.FromArgb(133, 192, 241), Color.FromArgb(76, 119, 163), LinearGradientMode.Vertical);
            innerBorderCheckedPen = new Pen(innerBorderCheckedBrush);

            borderPen = new Pen(Color.FromArgb(30, 30, 30));

            Font = new Font("Arial", 8);
        }
开发者ID:noscripter,项目名称:ShareX,代码行数:28,代码来源:BlackStyleCheckBox.cs

示例3: ReadGradient

        public static ColorBlend[] ReadGradient(BinaryFlashReader reader, bool bWithAlpha, bool morph)
        {
            ColorBlend[] clrs = new ColorBlend[2];

            int nNumRecords = reader.ReadByte();
            ColorBlend clrBlend = new ColorBlend(nNumRecords);
            ColorBlend clrBlendEnd = null;
            if (morph)
                clrBlendEnd = new ColorBlend(nNumRecords);

            for (int i = 0; i < nNumRecords; i++)
            {
                Color clr;
                byte ratio;
                ReadRecord(reader, bWithAlpha, out clr, out ratio);
                clrBlend.Colors[i] = clr;
                clrBlend.Positions[i] = (float)ratio/255;

                if (morph)
                {
                    ReadRecord(reader, bWithAlpha, out clr, out ratio);
                    clrBlendEnd.Colors[i] = clr;
                    clrBlendEnd.Positions[i] = (float)ratio/255;
                }
            }
            return clrs;
        }
开发者ID:timdetering,项目名称:Endogine,代码行数:27,代码来源:Gradient.cs

示例4: DrawRoundRect

        public void DrawRoundRect(Graphics g, Pen p, float X, float Y, float width, float height, float radius)
        {
            try
            {
                p.Width = 6;
                Rectangle r = this.ClientRectangle;
                // r.Width--; r.Height--;
                using (GraphicsPath rr = RoundRect(r, CornerRadius, CornerRadius, CornerRadius, CornerRadius))
                {
                    using (System.Drawing.Drawing2D.LinearGradientBrush gradBrush = new System.Drawing.Drawing2D.LinearGradientBrush(this.ClientRectangle, Color.Black, Color.Black, 90, false))
                    {

                        ColorBlend cb = new ColorBlend();
                        cb.Positions = new[] { 0, 1f };
                        cb.Colors = new[] { Color.Transparent, Color.Transparent };
                        gradBrush.InterpolationColors = cb;
                        // rotate
                        gradBrush.RotateTransform(0);
                        // paint
                        //g.FillPath(gradBrush, rr);
                        g.DrawPath(p, rr);
                    }
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
开发者ID:antonesterhuyse,项目名称:GrucoxScrumView,代码行数:29,代码来源:RoundedPamel.cs

示例5: SetColorBlend

 private void SetColorBlend(ColorBlend colorBlend)
 {
     for (var i = 0; i < colorBlend.Positions.Length; i++)
     {
         colorListBox.Items.Add(colorBlend.Colors[i]);
     }
 }
开发者ID:taozhengbo,项目名称:sdrsharp,代码行数:7,代码来源:GradientDialog.cs

示例6: ComputeColors

 public void ComputeColors(float hue, float saturation, float start, float start2, float end2, float end, float edge, int border)
 {
     this.border = border;
     this.colorStart = new Color[border];
     this.colorEnd = new Color[border];
     float num = (start2 - start) / (float)border;
     float num2 = (end2 - end) / (float)border;
     float num3 = start;
     float num4 = end;
     for (int i = 0; i < border; i++)
     {
         this.colorStart[i] = ColorUtils.HSLToRGB(hue, saturation, num3);
         this.colorEnd[i] = ColorUtils.HSLToRGB(hue, saturation, num4);
         num3 += num;
         num4 += num2;
     }
     this.colorEdge = ColorUtils.HSLToRGB(hue, saturation, edge);
     float num5 = (end2 - start2) / 9f;
     float num6 = start2;
     this.colorMiddle = new ColorBlend(10);
     for (int j = 0; j < 10; j++)
     {
         this.colorMiddle.Positions[j] = (float)j / 9f;
         this.colorMiddle.Colors[j] = ColorUtils.HSLToRGB(hue, saturation, num6);
         num6 += num5;
     }
 }
开发者ID:Azerothian,项目名称:fc3editor,代码行数:27,代码来源:ButtonShader.cs

示例7: DrawAquaPill

        public static void DrawAquaPill(Graphics g, RectangleF drawRectF, Color drawColor, Orientation orientation)
        {
            var colorBlend = new ColorBlend();

            var color1 = OpacityMix(Color.White, SoftLightMix(drawColor, Color.Black, 100), 40);
            var color2 = OpacityMix(Color.White, SoftLightMix(drawColor, CreateColorFromRgb(64, 64, 64), 100), 20);
            var color3 = SoftLightMix(drawColor, CreateColorFromRgb(128, 128, 128), 100);
            var color4 = SoftLightMix(drawColor, CreateColorFromRgb(192, 192, 192), 100);
            var color5 = OverlayMix(SoftLightMix(drawColor, Color.White, 100), Color.White, 75);

            //
            colorBlend.Colors = new[] { color1, color2, color3, color4, color5 };
            colorBlend.Positions = new[] { 0, 0.25f, 0.5f, 0.75f, 1 };
            var gradientBrush = orientation == Orientation.Horizontal ? new LinearGradientBrush(new Point((int)drawRectF.Left, (int)drawRectF.Top - 1), new Point((int)drawRectF.Left, (int)drawRectF.Top + (int)drawRectF.Height + 1), color1, color5) :
                new LinearGradientBrush(new Point((int)drawRectF.Left - 1, (int)drawRectF.Top), new Point((int)drawRectF.Left + (int)drawRectF.Width + 1, (int)drawRectF.Top), color1, color5);
            gradientBrush.InterpolationColors = colorBlend;
            FillPill(gradientBrush, drawRectF, g);

            //
            color2 = Color.White;
            colorBlend.Colors = new[] { color2, color3, color4, color5 };
            colorBlend.Positions = new[] { 0, 0.5f, 0.75f, 1 };
            gradientBrush = orientation == Orientation.Horizontal ? new LinearGradientBrush(new Point((int)drawRectF.Left + 1, (int)drawRectF.Top), new Point((int)drawRectF.Left + 1, (int)drawRectF.Top + (int)drawRectF.Height - 1), color2, color5) :
                                                                    new LinearGradientBrush(new Point((int)drawRectF.Left, (int)drawRectF.Top + 1), new Point((int)drawRectF.Left + (int)drawRectF.Width - 1, (int)drawRectF.Top + 1), color2, color5);
            gradientBrush.InterpolationColors = colorBlend;
            FillPill(gradientBrush, RectangleF.Inflate(drawRectF, -3, -3), g);
        }
开发者ID:reward-hunters,项目名称:PrintAhead,代码行数:27,代码来源:TrackBarDrawingHelper.cs

示例8: OnPaintBackground

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

            Graphics g = e.Graphics;
            Rectangle rect = new Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);

            using (LinearGradientBrush lgBrush = new LinearGradientBrush(Point.Empty, new PointF(0, Height),
                    ToolStripColorTable.ToolStripBackgroundTop, ToolStripColorTable.ToolStripBackgroundBottom))
            {
                ColorBlend blend = new ColorBlend(3);
                blend.Colors = new Color[] { ToolStripColorTable.ToolStripBackgroundTop, 
                    ToolStripColorTable.ToolStripBackgroundMiddle,ToolStripColorTable.ToolStripBackgroundMiddle,
                    ToolStripColorTable.ToolStripBackgroundBottom};
                blend.Positions = new float[] { 0.0f, 0.33f, 0.58f, 1.0f };

                lgBrush.InterpolationColors = blend;

                g.FillRectangle(lgBrush, rect);

                g.DrawLine(new Pen(ToolStripColorTable.ToolStripBackgroundBottomLine), 0, rect.Height - 2, rect.Width, rect.Height - 2);
                g.DrawLine(Pens.White, 0, Height, Width, Height);
            }

        }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:25,代码来源:ToolStripPanel.cs

示例9: OnRenderSeparator

        protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
        {
            // base.OnRenderSeparator(e);
            if (!e.Item.IsOnDropDown)
            {
                int top = 9;
                int left = e.Item.Width / 2; left--;
                int height = e.Item.Height - top  * 2;
                RectangleF separator = new RectangleF(left, top, 0.5f, height);

                using (LinearGradientBrush b = new LinearGradientBrush(
                    separator.Location,
                    new Point(Convert.ToInt32(separator.Left), Convert.ToInt32(separator.Bottom)),
                    Color.Red, Color.Black))
                {
                    ColorBlend blend = new ColorBlend();
                    blend.Colors = new Color[] { ToolStripColorTable.ToolStripSplitButtonTop, ToolStripColorTable.ToolStripSplitButtonMiddle, ToolStripColorTable.ToolStripSplitButtonMiddle, ToolStripColorTable.ToolStripSplitButtonBottom };
                    blend.Positions = new float[] { 0.0f, 0.22f, 0.78f, 1.0f };

                    b.InterpolationColors = blend;

                    e.Graphics.FillRectangle(b, separator);
                }
            }
        }
开发者ID:wenysky,项目名称:deepinsummer,代码行数:25,代码来源:ToolStripRender.cs

示例10: DrawFormBackgroud

        public void DrawFormBackgroud(Graphics g, Rectangle r)
        {
            drawing = new Bitmap(this.Width, AnimSize, g);
            gg = Graphics.FromImage(drawing);

            Rectangle shadowRect = new Rectangle(r.X, r.Y, r.Width, 10);
            Rectangle gradRect = new Rectangle(r.X, r.Y + 9, r.Width, AnimSize-9);
            LinearGradientBrush shadow = new LinearGradientBrush(shadowRect, Color.FromArgb(30, 61, 61), Color.FromArgb(47, colorR, colorR), LinearGradientMode.Vertical);
            //LinearGradientBrush shadow = new LinearGradientBrush(shadowRect, Color.FromArgb(30, 61, 41), Color.FromArgb(47, colorR, 64), LinearGradientMode.Vertical);
            LinearGradientBrush grad = new LinearGradientBrush(gradRect, Color.FromArgb(47, 64, 94), Color.FromArgb(49, 66, 95), LinearGradientMode.Vertical);
            //LinearGradientBrush grad = new LinearGradientBrush(gradRect, Color.Green, Color.DarkGreen, LinearGradientMode.Vertical);
            ColorBlend blend = new ColorBlend();

            // Set multi-color gradient
            blend.Positions = new[] { 0.0f, 0.35f, 0.5f, 0.65f, 0.95f,1f };
            blend.Colors = new[] { Color.FromArgb(47, colorR, colorR), Color.FromArgb(64, colorR + 22, colorR + 32), Color.FromArgb(66, colorR + 20, colorR + 35), Color.FromArgb(64, colorR + 20, colorR + 32), Color.FromArgb(49, colorR, colorR + 1), SystemColors.Control };
            //blend.Colors = new[] { Color.FromArgb(47, colorR, 64), Color.FromArgb(64, colorR + 32, 88), Color.FromArgb(66, colorR + 35, 90), Color.FromArgb(64, colorR + 32, 88), Color.FromArgb(49, colorR + 1, 66),SystemColors.Control };
            grad.InterpolationColors = blend;
            Font myf = new System.Drawing.Font(this.Font.FontFamily, 16);
            // Draw basic gradient and shadow
            //gg.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            gg.FillRectangle(grad, gradRect);
            gg.FillRectangle(shadow, shadowRect);
            gg.TextRenderingHint = TextRenderingHint.AntiAlias;
            gg.DrawString("Поиск по ресурсам сети", myf, Brushes.GhostWhite, new PointF(55, 15));
            gg.DrawImage(Properties.Resources.search1.ToBitmap(), 10, 10,32,32);

            g.DrawImageUnscaled(drawing, 0, 0);
            gg.Dispose();

            // Draw checkers
            //g.FillRectangle(checkers, r);
        }
开发者ID:fenriv,项目名称:NetOpen,代码行数:33,代码来源:ShareSearch.cs

示例11: OnRenderToolStripBackground

        protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
        {
            base.OnRenderToolStripBackground(e);

            if (e.ToolStrip is ToolStripDropDownMenu) return;
            using (LinearGradientBrush lgBrush = new LinearGradientBrush(Point.Empty, new PointF(0, e.ToolStrip.Height),
                    ToolStripColorTable.ToolStripBackgroundTop, ToolStripColorTable.ToolStripBackgroundBottom))
            {
                ColorBlend blend = new ColorBlend(3);
                blend.Colors = new Color[] { ToolStripColorTable.ToolStripBackgroundTop, 
                    ToolStripColorTable.ToolStripBackgroundMiddle,ToolStripColorTable.ToolStripBackgroundMiddle,
                    ToolStripColorTable.ToolStripBackgroundBottom};
                blend.Positions = new float[] { 0.0f, 0.33f,0.58f, 1.0f };

                lgBrush.InterpolationColors = blend;            

                using (GraphicsPath border = GetToolStripRectangle(e.ToolStrip))
                {
                    e.Graphics.FillPath(lgBrush, border);
                    e.Graphics.DrawLine(new Pen( ToolStripColorTable.ToolStripBackgroundTopLine), 0, 0, e.ToolStrip.Width, 0);
                    e.Graphics.DrawLine(new Pen( ToolStripColorTable.ToolStripBackgroundBottomLine), 0, e.ToolStrip.Height - 2,
                        e.ToolStrip.Width, e.ToolStrip.Height - 2);
                }
            }

        }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:26,代码来源:ToolStripRender.cs

示例12: Render

        public override void Render(Graphics g)
        {
            //theCode, love theVariableNames :D [Xylem]
            //Set the hue shades with the correct saturation and luminance
            Color[] theColors =
                {
                    new ColorManager.HSVColor(0, CurrentColor.HSV.S, CurrentColor.HSV.V).ToColor(),
                    new ColorManager.HSVColor(60, CurrentColor.HSV.S, CurrentColor.HSV.V).ToColor(),
                    new ColorManager.HSVColor(120, CurrentColor.HSV.S, CurrentColor.HSV.V).ToColor(),
                    new ColorManager.HSVColor(180, CurrentColor.HSV.S, CurrentColor.HSV.V).ToColor(),
                    new ColorManager.HSVColor(240, CurrentColor.HSV.S, CurrentColor.HSV.V).ToColor(),
                    new ColorManager.HSVColor(300, CurrentColor.HSV.S, CurrentColor.HSV.V).ToColor(),
                    new ColorManager.HSVColor(360, CurrentColor.HSV.S, CurrentColor.HSV.V).ToColor(),
                };

            //Calculate positions
            float percent = 1.0f / 6;
            float[] thePositions = {0.0f, percent, percent * 2, percent * 3, percent * 4, percent * 5, 1.0f};
            //Set blend
            var theBlend = new ColorBlend();
            theBlend.Colors = theColors;
            theBlend.Positions = thePositions;
            //Get rectangle
            var colorRect = new Rectangle(0, (Slider.Height / 2) - 3, Slider.Width - 6, 4);
            //Make the linear brush and assign the custom blend to it
            var theBrush = new LinearGradientBrush(colorRect,
                                                   Color.Red,
                                                   Color.Red, 0, false);
            theBrush.InterpolationColors = theBlend;
            //Draw rectangle
            g.FillRectangle(theBrush, colorRect);
            //Draw border and trackbar
            g.DrawRectangle(Pens.Black, new Rectangle(0, (Slider.Height / 2) - 3, Slider.Width - 6, 4));
            DrawThumb(g);
        }
开发者ID:rmbzlib,项目名称:mcskin3d,代码行数:35,代码来源:HueSliderRenderer.cs

示例13: DrawAquaPillSingleLayer

		/// <summary>
		/// 
		/// </summary>
		/// <param name="g"></param>
		/// <param name="drawRectF"></param>
		/// <param name="drawColor"></param>
		/// <param name="orientation"></param>
		public static void DrawAquaPillSingleLayer(Graphics g, RectangleF drawRectF, Color drawColor, Orientation orientation, BrushStyle brushStyle)
		{
		    if (brushStyle == BrushStyle.LinearGradient)
		    {
		        var colorBlend = new ColorBlend();
		        var color1 = drawColor;
                var color2 = ControlPaint.Light(color1);
                var color3 = ControlPaint.Light(color2);
                var color4 = ControlPaint.Light(color3);

		        colorBlend.Colors = new[] {color1, color2, color3, color4};
		        colorBlend.Positions = new[] {0, 0.25f, 0.65f, 1};

		        var gradientBrush = orientation == Orientation.Horizontal
		                                                ? new LinearGradientBrush(
		                                                      new Point((int) drawRectF.Left, (int) drawRectF.Top),
		                                                      new Point((int) drawRectF.Left,
		                                                                (int) drawRectF.Top + (int) drawRectF.Height), color1,
		                                                      color4)
		                                                : new LinearGradientBrush(
		                                                      new Point((int) drawRectF.Left, (int) drawRectF.Top),
		                                                      new Point((int) drawRectF.Left + (int) drawRectF.Width,
		                                                                (int) drawRectF.Top), color1, color4);
		        gradientBrush.InterpolationColors = colorBlend;

		        FillPill(gradientBrush, drawRectF, g);
		    }
		    else
		    {
                FillPill(new SolidBrush(drawColor), drawRectF, g);
		    }
		}
开发者ID:paolosalvatori,项目名称:servicefabriceventhubdemo,代码行数:39,代码来源:CustomStyleHelper.cs

示例14: DrawAquaPill

        /// <summary>
        /// 
        /// </summary>
        /// <param name="g"></param>
        /// <param name="drawRectF"></param>
        /// <param name="drawColor"></param>
        /// <param name="orientation"></param>
        public static void DrawAquaPill(Graphics g, RectangleF drawRectF, Color drawColor, Orientation orientation)
        {
            System.Drawing.Drawing2D.LinearGradientBrush gradientBrush;
            System.Drawing.Drawing2D.ColorBlend colorBlend = new System.Drawing.Drawing2D.ColorBlend();

            var color1 = ColorHelper.OpacityMix(Color.White, ColorHelper.SoftLightMix(drawColor, Color.Black, 100), 40);
            var color2 = ColorHelper.OpacityMix(Color.White, ColorHelper.SoftLightMix(drawColor, ColorHelper.CreateColorFromRGB(64, 64, 64), 100), 20);
            var color3 = ColorHelper.SoftLightMix(drawColor, ColorHelper.CreateColorFromRGB(128, 128, 128), 100);
            var color4 = ColorHelper.SoftLightMix(drawColor, ColorHelper.CreateColorFromRGB(192, 192, 192), 100);
            var color5 = ColorHelper.OverlayMix(ColorHelper.SoftLightMix(drawColor, Color.White, 100), Color.White, 75);

            //
            colorBlend.Colors = new Color[] { color1, color2, color3, color4, color5 };
            colorBlend.Positions = new float[] { 0, 0.25f, 0.5f, 0.75f, 1 };
            if (orientation == Orientation.Horizontal)
                gradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(new Point((int)drawRectF.Left, (int)drawRectF.Top - 1), new Point((int)drawRectF.Left, (int)drawRectF.Top + (int)drawRectF.Height + 1), color1, color5);
            else
                gradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(new Point((int)drawRectF.Left - 1, (int)drawRectF.Top), new Point((int)drawRectF.Left + (int)drawRectF.Width + 1, (int)drawRectF.Top), color1, color5);
            gradientBrush.InterpolationColors = colorBlend;
            FillPill(gradientBrush, drawRectF, g);

            //
            color2 = Color.White;
            colorBlend.Colors = new Color[] { color2, color3, color4, color5 };
            colorBlend.Positions = new float[] { 0, 0.5f, 0.75f, 1 };
            if (orientation == Orientation.Horizontal)
                gradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(new Point((int)drawRectF.Left + 1, (int)drawRectF.Top), new Point((int)drawRectF.Left + 1, (int)drawRectF.Top + (int)drawRectF.Height - 1), color2, color5);
            else
                gradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(new Point((int)drawRectF.Left, (int)drawRectF.Top + 1), new Point((int)drawRectF.Left + (int)drawRectF.Width - 1, (int)drawRectF.Top + 1), color2, color5);
            gradientBrush.InterpolationColors = colorBlend;
            FillPill(gradientBrush, RectangleF.Inflate(drawRectF, -3, -3), g);
        }
开发者ID:jn84,项目名称:FOS-SaveEditor,代码行数:39,代码来源:DrawMACStyleHelper.cs

示例15: DrawFormBackgroud

        public void DrawFormBackgroud(Graphics g, Rectangle r)
        {
            drawing = new Bitmap(this.Width, this.Height, g);
            gg = Graphics.FromImage(drawing);

            Rectangle shadowRect = new Rectangle(r.X, r.Y, r.Width, 10);
            Rectangle gradRect = new Rectangle(r.X, r.Y + 9, r.Width, 42);
            //LinearGradientBrush shadow = new LinearGradientBrush(shadowRect, Color.FromArgb(30, 41, 61), Color.FromArgb(47, 64, 94), LinearGradientMode.Vertical);
            LinearGradientBrush shadow = new LinearGradientBrush(shadowRect, Color.FromArgb(30, 61, 41), Color.FromArgb(47, colorR, 64), LinearGradientMode.Vertical);
            //LinearGradientBrush grad = new LinearGradientBrush(gradRect, Color.FromArgb(47, 64, 94), Color.FromArgb(49, 66, 95), LinearGradientMode.Vertical);
            LinearGradientBrush grad = new LinearGradientBrush(gradRect, Color.Green, Color.DarkGreen, LinearGradientMode.Vertical);
            ColorBlend blend = new ColorBlend();

            // Set multi-color gradient
            blend.Positions = new[] { 0.0f, 0.35f, 0.5f, 0.65f, 1.0f };
            //blend.Colors = new[] { Color.FromArgb(47, 64, 94), Color.FromArgb(64, 88, 126), Color.FromArgb(66, 90, 129), Color.FromArgb(64, 88, 126), Color.FromArgb(49, 66, 95) };
            blend.Colors = new[] { Color.FromArgb(47,colorR, 64), Color.FromArgb(64, colorR+32, 88), Color.FromArgb(66, colorR+35, 90), Color.FromArgb(64, colorR+32, 88), Color.FromArgb(49, colorR+1, 66) };
            grad.InterpolationColors = blend;
            Font myf=new System.Drawing.Font(this.Font.FontFamily,16);
            // Draw basic gradient and shadow
            //gg.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            gg.FillRectangle(grad, gradRect);
            gg.FillRectangle(shadow, shadowRect);
            gg.DrawString("Добавить один ПК", myf, Brushes.GhostWhite, new PointF(55, 15));
            gg.DrawImage(Properties.Resources.singleAdd1.ToBitmap(), 10, 10,32,32);

            g.DrawImageUnscaled(drawing, 0, 0);
            gg.Dispose();

            // Draw checkers
            //g.FillRectangle(checkers, r);
        }
开发者ID:fenriv,项目名称:NetOpen,代码行数:32,代码来源:SinglePCAdd.cs


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