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


C# LinearGradientBrush.Dispose方法代码示例

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


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

示例1: EDSToolTip_Draw

        void EDSToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            if (e.ToolTipText.Trim() != "")
            {
                //e.DrawBackground();
                Graphics g = e.Graphics;

                //draw background
                LinearGradientBrush lgb = new LinearGradientBrush(new Rectangle(Point.Empty, e.Bounds.Size), Color.FromArgb(250, 252, 253), Color.FromArgb(206, 220, 240), LinearGradientMode.Vertical);
                g.FillRectangle(lgb, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));
                lgb.Dispose();

                //Console.WriteLine(e.ToolTipText);

                //draw border
                ControlPaint.DrawBorder(g, e.Bounds, SystemColors.GrayText, ButtonBorderStyle.Dashed);
                //draw Image
                g.DrawImage(image, new Point(5, 5));

                // Draw the custom text.
                // The using block will dispose the StringFormat automatically.
                using (StringFormat sf = new StringFormat())
                {
                    using (Font f = new Font("Tahoma", 8))
                    {
                        e.Graphics.DrawString(e.ToolTipText, f,
                            Brushes.Black, e.Bounds.X + 25, e.Bounds.Y + 30, StringFormat.GenericTypographic);
                    }
                }
            }
        }
开发者ID:vineelkovvuri,项目名称:ExtendableDesktopSearch,代码行数:31,代码来源:EDSToolTip.cs

示例2: OnPaint

        protected override void OnPaint(PaintEventArgs paintEvent)
        {
            base.OnPaint(paintEvent);
            paintEvent.Graphics.Clear(_backgroundColor);

            // High Rendering For Radiobutton Circle
            paintEvent.Graphics.SmoothingMode = SmoothingMode.HighQuality;

            // Draw Cirle & Border
            Brush gradientBrush = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(14, 14)),
                _primaryGradientColor, _secondaryGradientColor, 90.0F);
            paintEvent.Graphics.FillEllipse(gradientBrush, new Rectangle(0, 0, 14, 14));
            paintEvent.Graphics.DrawEllipse(new Pen(_borderColor), new Rectangle(0, 0, 14, 14));

            // Draw Text
            paintEvent.Graphics.DrawString(this.Text, _font, new SolidBrush(_textColor), new PointF(19, 0));

            if (this.Checked)
            {
                paintEvent.Graphics.FillEllipse(new SolidBrush(_bulletColor), new Rectangle(4, 4, 6, 6));
            }

            // Dispose Of Brushes & Pens
            gradientBrush.Dispose();
        }
开发者ID:ErwanLent,项目名称:Origin-Theme-GDI-Library,代码行数:25,代码来源:PrimaryRadioButton.cs

示例3: OnPaint

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

            Graphics G = e.Graphics;
            LinearGradientBrush linearGradientBrush1 = new LinearGradientBrush(//创建线性渐变画刷
            new Point(0, 0),new Point(20, 20),                  //渐变起始点和终止点
            Color.Yellow,Color.Blue);                           //渐变起始颜色和终止颜色
            G.FillRectangle(linearGradientBrush1, new Rectangle(0, 0, 150, 150));//绘制矩形
            LinearGradientBrush linearGradientBrush2 = new LinearGradientBrush(//创建线性渐变画刷
            new Rectangle(0, 0, 20, 20),                      //渐变所在矩形
            Color.Yellow, Color.Blue, 60f);                     //渐变起始颜色、终止颜色以及渐变方向
            linearGradientBrush2.WrapMode = WrapMode.TileFlipXY;
            G.FillRectangle(linearGradientBrush2, new Rectangle(150, 0, 150, 150));//绘制矩形

            GraphicsPath graphicsPath1 = new GraphicsPath();        //创建绘制路径
            graphicsPath1.AddArc(new Rectangle(0, 150, 100, 100), 90, 180);//向路径中添加半左圆弧
            graphicsPath1.AddArc(new Rectangle(150, 150, 100, 100), 270, 180);//向路径中添加半右圆弧
            graphicsPath1.CloseFigure();                            //闭合路径
            PathGradientBrush pathGradientBrush = new PathGradientBrush(graphicsPath1);//创建路径渐变画刷
            pathGradientBrush.CenterColor = Color.Yellow;           //指定画刷中心颜色
            pathGradientBrush.SurroundColors = new Color[] { Color.Blue };//指定画刷周边颜色
            pathGradientBrush.CenterPoint = new PointF(125, 200);   //指定画刷中心点坐标
            G.SmoothingMode = SmoothingMode.AntiAlias;              //消锯齿
            G.FillPath(pathGradientBrush, graphicsPath1);           //利用画刷填充路径
            G.DrawPath(new Pen(Color.Lime, 3f), graphicsPath1);     //绘制闭合路径曲线

            linearGradientBrush1.Dispose();
            linearGradientBrush2.Dispose();
            graphicsPath1.Dispose();
            pathGradientBrush.Dispose();
        }
开发者ID:dalinhuang,项目名称:wdeqawes-efrwserd-rgtedrtf,代码行数:32,代码来源:FormGradientBrush.cs

示例4: FillRoundedRectangle

        public static void FillRoundedRectangle(Rectangle rectangle, GlassGradient gradient, bool isSunk, bool isGlass,
                                                Graphics graphics)
        {
            if (rectangle.Width == 0 || rectangle.Height == 0)
                return;

            var path = GetRoundedRectanglePath(rectangle);

            var activeGradient = isSunk
                                     ? new GlassGradient(gradient.Bottom, gradient.Top)
                                     : new GlassGradient(gradient.Top, gradient.Bottom);

            var brush = activeGradient.GetBrush(rectangle);
            graphics.FillPath(brush, path);
            brush.Dispose();

            if (isGlass)
            {
                graphics.SetClip(path);

                var glassRectangle = isSunk
                                         ? new Rectangle(new Point(rectangle.Left, rectangle.Height/2),
                                                         new Size(rectangle.Width, rectangle.Height/2))
                                         : new Rectangle(rectangle.Location,
                                                         new Size(rectangle.Width, rectangle.Height/2));
                var glassPath = GetRoundedRectanglePath(glassRectangle);
                Brush glassBrush = new LinearGradientBrush(glassRectangle, Color.Transparent,
                                                           Color.FromArgb(32, 255, 255, 255), 90.0f);

                graphics.FillPath(glassBrush, glassPath);

                glassBrush.Dispose();
                glassPath.Dispose();
            }
        }
开发者ID:HudsonAkridge,项目名称:Terrarium-2.5,代码行数:35,代码来源:GlassHelper.cs

示例5: Draw

        /// <summary>
        /// The graphics device and clip rectangle are in the parent coordinates.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="clipRectangle"></param>
        /// <param name="symbol">The symbol to use for drawing.</param>
        public void Draw(Graphics g, Rectangle clipRectangle, ISymbol symbol)
        {
            Color topLeft;
            Color bottomRight;
            if (_isSelected)
            {
                topLeft = _selectionColor.Darker(.3F);
                bottomRight = _selectionColor.Lighter(.3F);
            }
            else
            {
                topLeft = _backColor.Lighter(.3F);
                bottomRight = _backColor.Darker(.3F);
            }
            LinearGradientBrush b = new LinearGradientBrush(_bounds, topLeft, bottomRight, LinearGradientMode.ForwardDiagonal);
            GraphicsPath gp = new GraphicsPath();
            gp.AddRoundedRectangle(Bounds, _roundingRadius);
            g.FillPath(b, gp);
            gp.Dispose();
            b.Dispose();

            Matrix old = g.Transform;
            Matrix shift = g.Transform;
            shift.Translate(_bounds.Left + _bounds.Width / 2, _bounds.Top + _bounds.Height / 2);
            g.Transform = shift;

            if (symbol != null)
            {
                OnDrawSymbol(g, symbol);
            }

            g.Transform = old;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:39,代码来源:SizeBox.cs

示例6: TimeViewer_Paint

        private void TimeViewer_Paint(object sender, PaintEventArgs e)
        {
            LinearGradientBrush b1 = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.LightGreen, Color.Green, LinearGradientMode.Vertical);
            e.Graphics.FillRectangle(b1, 0, 0, round * Width, 30);
            b1.Dispose();

            Font font = new Font("Arial", 20*1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
            e.Graphics.DrawString(string.Format("{0:00}:{1:00}", time / 4, (time % 4) * 15), font, Brushes.White, 22, 0);
            font.Dispose();

            if(isShow)
            {
                string url = string.Format("d{0}.JPG", daytime);
                Image img = PicLoader.Read("Weather", url);
                e.Graphics.DrawImage(img, 6, 35, 30, 30);
                img.Dispose();
                url = string.Format("w{0}.JPG", weather);
                img = PicLoader.Read("Weather", url);
                e.Graphics.DrawImage(img, 41, 35, 30, 30);
                img.Dispose();
                url = string.Format("s{0}.JPG", special);
                img = PicLoader.Read("Weather", url);
                e.Graphics.DrawImage(img, 76, 35, 30, 30);
                img.Dispose();
            }
        }
开发者ID:narlon,项目名称:TOMClassic,代码行数:26,代码来源:TimeViewer.cs

示例7: OnPaintBackground

 /// <summary>
 /// Paints the background in the gradient brush
 /// </summary>
 /// <param name="e"></param>
 protected override void OnPaintBackground(PaintEventArgs pevent)
 {
     LinearGradientBrush brush = 
         new LinearGradientBrush(pevent.ClipRectangle, _startColor, _endColor,  _gradientMode);
     pevent.Graphics.FillRectangle(brush, pevent.ClipRectangle);
     brush.Dispose();
 }
开发者ID:TimVelo,项目名称:StackBuilder,代码行数:11,代码来源:GradientPanel.cs

示例8: DrawGlass

        public static void DrawGlass(Rectangle rectangle, Graphics graphics)
        {
            if (rectangle.Width == 0 || rectangle.Height == 0)
                return;

            var clipPath = GetRoundedRectanglePath(rectangle);

            graphics.SetClip(clipPath);

            var glassRectangle = new Rectangle(rectangle.Location, new Size(rectangle.Width, rectangle.Height/2));

            // Apply a glass look
            Brush glassBrush = new LinearGradientBrush(glassRectangle, Color.Transparent,
                                                       Color.FromArgb(32, 255, 255, 255), 90.0f);

            var glassPath = GetRoundedRectanglePath(glassRectangle);

            graphics.FillPath(glassBrush, glassPath);

            glassPath.Dispose();
            glassBrush.Dispose();

            glassRectangle = new Rectangle(0, rectangle.Height - (rectangle.Height/4), rectangle.Width,
                                           rectangle.Height*3);
            glassPath = GetRoundedRectanglePath(glassRectangle);
            glassBrush = new SolidBrush(Color.FromArgb(16, Color.White));

            glassBrush.Dispose();
            glassPath.Dispose();

            graphics.SetClip(rectangle);
            clipPath.Dispose();
        }
开发者ID:Carolasb,项目名称:Terrarium,代码行数:33,代码来源:GlassHelper.cs

示例9: OnRenderToolStripBackground

        protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
        {
            Graphics g = e.Graphics;
            LinearGradientBrush b = new LinearGradientBrush(e.AffectedBounds, Color.DarkGray, Color.Black, 90);
            g.FillRectangle(b, e.AffectedBounds);
            b.Dispose();

            base.OnRenderToolStripBackground(e);
        }
开发者ID:ehershey,项目名称:development,代码行数:9,代码来源:CustomRenderer.cs

示例10: OnPaint

 protected override void OnPaint(PaintEventArgs e)
 {
     LinearGradientBrush b = new LinearGradientBrush(this.ClientRectangle,
         Color.FromArgb(150, 200, 255),
         Color.FromArgb(40, 65, 150),
         LinearGradientMode.ForwardDiagonal);
     e.Graphics.FillRectangle(b, e.ClipRectangle);
     b.Dispose();
 }
开发者ID:rohancragg,项目名称:FileHelpers,代码行数:9,代码来源:frmDonate.cs

示例11: PaintValue

		public override void PaintValue( PaintValueEventArgs args ) 
		{
			MetalGradient gradient = (MetalGradient)args.Value;
		
			LinearGradientBrush gradientBrush = new LinearGradientBrush( args.Bounds, gradient.Top, gradient.Bottom, 90.0f );

			args.Graphics.FillRectangle( gradientBrush, args.Bounds );

			gradientBrush.Dispose();
		}
开发者ID:HudsonAkridge,项目名称:Terrarium-2.5,代码行数:10,代码来源:MetalGradient.cs

示例12: OnPaintBackground

 protected override void OnPaintBackground(PaintEventArgs e)
 {
     var g = e.Graphics;
     Brush b = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), Color.FromArgb(20, 30, 39), Color.FromArgb(41, 49, 73));
     var p = new Pen(Color.FromArgb(71, 84, 108));
     g.FillRectangle(b, ClientRectangle);
     g.DrawRectangle(p, new Rectangle(0, ClientSize.Height - 1, ClientSize.Width - 1, ClientSize.Height - 1));
     p.Dispose();
     b.Dispose();
 }
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:10,代码来源:WizardShell.cs

示例13: OnPaint

 protected override void OnPaint(PaintEventArgs e)
 {
     base.OnPaint(e);
     Graphics G = e.Graphics;
     LinearGradientBrush brush = new LinearGradientBrush(
         new Point(0, 0), new Point(20, 20), Color.Blue, Color.Green);
     brush.WrapMode = WrapMode.TileFlipXY;
     G.FillRectangle(brush, this.ClientRectangle);
     brush.Dispose();
 }
开发者ID:dalinhuang,项目名称:wdeqawes-efrwserd-rgtedrtf,代码行数:10,代码来源:Form1.cs

示例14: OnPaint

        protected override void OnPaint(PaintEventArgs e)
        {
            Color color1 = Color.FromArgb(255,229,163);
            Color color2 = Color.FromArgb(253, 178, 51);

            LinearGradientBrush br = new LinearGradientBrush(this.ClientRectangle, color1 , color2, LinearGradientMode.Vertical);
            e.Graphics.FillRectangle(br, this.ClientRectangle);
            br.Dispose();
            base.OnPaint(e);
        }
开发者ID:anujahuja,项目名称:hyvesfotos,代码行数:10,代码来源:GradientPanel.cs

示例15: About_Paint

 private void About_Paint(object sender, PaintEventArgs e)
 {
     Graphics g = e.Graphics;
     g.SmoothingMode = SmoothingMode.HighSpeed;
     LinearGradientBrush br = new LinearGradientBrush(new Point(0, 0), new Point(500, 400), Color.BurlyWood, Color.CornflowerBlue);
     LinearGradientBrush br1 = new LinearGradientBrush(new Point(0, 0), new Point(500, 400), Color.DarkMagenta, Color.RosyBrown);
     g.FillRectangle(br, new Rectangle(0, 0, this.Width, this.Height));
     g.DrawRectangle(new Pen(br1, 6), new Rectangle(0, 0, this.Width-1, this.Height-1));
     br.Dispose();
     br1.Dispose();
 }
开发者ID:rocketreal,项目名称:Pikachu,代码行数:11,代码来源:About.cs


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