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

C# Drawing2D.ColorBlend类代码示例

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

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



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


示例16: DrawSelectionFrame

		//render using new style
		protected override void DrawSelectionFrame(PaintEventArgs e, Rectangle rct, ButtonState state)
		{
			if (state == ButtonState.Checked ||
			    state == ButtonState.Pushed) {
				e.Graphics.PixelOffsetMode = PixelOffsetMode.None;
				e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
				rct.Width--;
				rct.Height--;
				using (GraphicsPath pth = CreateRoundedRect(2, rct)) {
					using (LinearGradientBrush brs = new LinearGradientBrush(
						new Point(0, rct.Bottom), new Point(0, rct.Y),
						Color.Black, Color.White)) {
						ColorBlend colorblnd = new ColorBlend();
						colorblnd.Positions = new float[]
						                      	{
						                      		0F, 0.5F, 0.50F, 1F
						                      	};
						colorblnd.Colors = new Color[]
						                   	{
						                   		Color.FromArgb(255, 236, 181),
						                   		Color.FromArgb(255, 236, 181),
						                   		Color.FromArgb(255, 243, 207),
						                   		Color.FromArgb(255, 252, 242)
						                   	};
						//
						brs.InterpolationColors = colorblnd;
						e.Graphics.FillPath(brs, pth);
					}
					using (Pen pn = new Pen(Color.FromArgb(229, 195, 101)))
						e.Graphics.DrawPath(pn, pth);
				}
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:34,代码来源:ActionList.cs


示例17: VerticalMeterData

        public VerticalMeterData()
        {
            Inverted = false;
            DecayTime = 1500;
            AttackTime = 50;
            Normalize = true;
            Gain = 0;
            Range = 10;
            RedColorPosition = 95;
            GreenColorPosition = 25;
            MeterColorStyle = MeterColorTypes.Linear;

            LowPass = false;
            LowPassFreq = 100;
            HighPass = false;
            HighPassFreq = 500;

            Color[] myColors = { Color.Lime, Color.Yellow, Color.Red };
            float[] myPositions = { 0, (float)GreenColorPosition / 100, (float)RedColorPosition / 100 };
            ColorBlend linearBlend = new ColorBlend();
            linearBlend.Colors = myColors;
            linearBlend.Positions = myPositions;

            ColorGradient linearGradient = new ColorGradient(linearBlend);

            IntensityCurve = new Curve();
            IntensityCurve.Points.Clear();
            IntensityCurve.Points.Add(new ZedGraph.PointPair(0, 100));
            IntensityCurve.Points.Add(new ZedGraph.PointPair(100, 100));

            MeterColorGradient = linearGradient;

            DepthOfEffect = 0;
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:34,代码来源:VerticalMeterData.cs


示例18: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                BniFileParser bni = new BniFileParser(@"C:\Projects\jinxbot\branches\mbncsutil\trunk\mbnftp\bin\Debug\icons.bni");
                this.pictureBox1.Image = bni.FullImage;

                foreach (BniIcon icon in bni.AllIcons)
                {
                    this.flowContainer.Controls.Add(new IconRep(icon));
                }
            }
            catch { }

            Bitmap bmp = new Bitmap(28, 12);
            Rectangle bounds = new Rectangle(0, 0, 28, 12);
            using (Graphics g = Graphics.FromImage(bmp))
            using (LinearGradientBrush b = new LinearGradientBrush(bounds, Color.Black, Color.Black, 0, false))
            {
                ColorBlend cb = new ColorBlend();
                cb.Colors = new Color[] { Color.LimeGreen, Color.Lime, Color.Yellow, Color.Orange, Color.OrangeRed, Color.Maroon };
                cb.Positions = new float[] { 0f, 0.1f, 0.4f, 0.6f, 0.9f, 1f };
                b.InterpolationColors = cb;

                g.FillRectangle(b, bounds);
            }
            pictureBox2.Image = bmp;
        }
开发者ID:Mofsy,项目名称:jinxbot,代码行数:28,代码来源:Form1.cs


示例19: DrawFromAlphaMainPart

        /// <summary>
        /// 绘制窗体主体部分白色透明层
        /// </summary>
        /// <param name="form"></param>
        /// <param name="g"></param>
        public static void DrawFromAlphaMainPart(Form form, Graphics g)
        {
            Color[] colors =
            {
                Color.FromArgb(5, Color.White),
                Color.FromArgb(30, Color.White),
                Color.FromArgb(145, Color.White),
                Color.FromArgb(150, Color.White),
                Color.FromArgb(30, Color.White),
                Color.FromArgb(5, Color.White)
            };

            float[] pos =
            {
                0.0f,
                0.04f,
                0.10f,
                0.90f,
                0.97f,
                1.0f
            };

            ColorBlend colorBlend = new ColorBlend(6);
            colorBlend.Colors = colors;
            colorBlend.Positions = pos;

            RectangleF destRect = new RectangleF(0, 0, form.Width, form.Height);
            using (LinearGradientBrush lBrush = new LinearGradientBrush(destRect, colors[0], colors[5], LinearGradientMode.Vertical))
            {
                lBrush.InterpolationColors = colorBlend;
                g.FillRectangle(lBrush, destRect);
            }
        }
开发者ID:KeithLee208,项目名称:ISoft_Source,代码行数:38,代码来源:FormDemo.cs


示例20: DrawNaviBarOverFlowPanelBg

      /// <summary>
      /// Draws the background of the rectangle containing the small buttons on the bottom 
      /// of the NavigationBar
      /// </summary>
      /// <param name="g">The graphics surface to draw on</param>
      /// <param name="bounds">The bounds of the small rectangle</param>
      public override void DrawNaviBarOverFlowPanelBg(Graphics g, Rectangle bounds)
      {
         // Background
         Color[] EndColors = { ColorTable.ButtonNormalColor2, ColorTable.ButtonNormalColor1 };
         float[] ColorPositions = { 0.0f, 1.0f };

         ColorBlend blend = new ColorBlend();

         blend.Colors = EndColors;
         blend.Positions = ColorPositions;

         if (bounds.Height == 0)
            bounds.Height = 1; // its to prevent an out of memory exception
         if (bounds.Width == 0)
            bounds.Width = 1;

         // Make the linear brush and assign the custom blend to it
         using (LinearGradientBrush brush = new LinearGradientBrush(new Point(bounds.Left, bounds.Bottom),
                                                           new Point(bounds.Left, bounds.Top),
                                                           Color.White,
                                                           Color.Black))
         {
            brush.InterpolationColors = blend;
            g.FillRectangle(brush, bounds);
         }

         using (Pen p = new Pen(ColorTable.Border))
         {
            g.DrawLine(p, bounds.Left, bounds.Top, bounds.Right, bounds.Top);
         }
      }
开发者ID:iraychen,项目名称:Guifreaks-Navisuite,代码行数:37,代码来源:NaviOffice3Renderer.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Drawing2D.GraphicsPath类代码示例发布时间:2022-05-26
下一篇:
C# Drawing2D.Blend类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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