當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。