bool b = false;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
b = true;
a.Clear();
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
b = false;
}
ArrayList a = new ArrayList();
Point[] p = new Point[50];
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (b == true)
{
a.Add(new Point(e.X, e.Y));
if (a.Count >= 50)
{
for (int i = 0; i < a.Count - 50; i++)
{
a.RemoveAt(i);
}
a.CopyTo(p);
}
else
{
a.CopyTo(p);
}
Bitmap bp = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(bp);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Pen pn = new Pen(Brushes.Black);
pn.Width = 2;
pn.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
g.DrawLines(pn, p);
this.BackgroundImage = bp;
}