int x1, y1 = 0;
bool c = false;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
x1 = e.X;
y1 = e.Y;
c = true;
al.Add(new Point(e.X, e.Y));
}
System.Collections.ArrayList al = new System.Collections.ArrayList();
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (c == true)
{
System.Drawing.Drawing2D.LinearGradientBrush brush1= new
System.Drawing.Drawing2D.LinearGradientBrush(
new Rectangle(0, 0, 2, 2), Color.YellowGreen, Color.Green,
System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal);
Bitmap b = new Bitmap(Width, Height);
Graphics g = Graphics.FromImage(b);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
al.Add(new Point(e.X, e.Y));
Point[] p = new Point[al.Count];
al.CopyTo(p);
g.DrawLines(new Pen(brush1,5), p);
this.BackgroundImage = b;
}
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
c = false;
}