Linear Gradient Brush : Gradient Brush : Drawing 2D C# Examples


C# Examples » Drawing 2D » Gradient Brush »

 

Linear Gradient Brush








    
using  System;
using  System.Drawing;
using  System.Drawing.Drawing2D;
using  System.Collections;
using  System.ComponentModel;
using  System.Windows.Forms;
using  System.Data;

public  class  BrushLinearGradient  :  System.Windows.Forms.Form
{
    public  BrushLinearGradient()
    {
        this.BackColor  =  System.Drawing.Color.White;
        this.ClientSize  =  new  System.Drawing.Size(400,  400);
        this.Paint  +=  new  System.Windows.Forms.PaintEventHandler(this.BrushLinearGradient_Paint);
    }

    static  void  Main()  
    {
        Application.Run(new  BrushLinearGradient());
    }

    private  void  BrushLinearGradient_Paint(object  sender,  System.Windows.Forms.PaintEventArgs  e)
    {
        Graphics  g  =  e.Graphics;

        Brush  brGradient  =  new  LinearGradientBrush(new  Rectangle(0,  0,  200,  200),  Color.Black,  Color.LightGray,  45,  false);
        g.FillRectangle(brGradient,  10,  10,  200,  200);
    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Drawing 2D
» Gradient Brush