void PictureBox1MouseDown(object sender, MouseEventArgs e) { rightPressed = true; //The timer is used to perform the actual drawing without any need of moving //a mouse(specifically used with spraying tool. timer1.Enabled = true; if (e.Button == MouseButtons.Left) { rightPressed = false; } switch (selectedTool) { case ActiveTool.Pen: case ActiveTool.Spray: case ActiveTool.Rectangle: case ActiveTool.Ellipse: isEditing = true; pointsToDraw.Add(new Point(e.Location.X, e.Location.Y)); pointsToDraw.Add(new Point(e.Location.X, e.Location.Y)); break; case ActiveTool.Fill: Color onPointer = bmp.GetPixel(e.Location.X, e.Location.Y); Color toFill = colors[Convert.ToInt16(rightPressed)]; fl.FillRegion(bmp, pictureBox1, new Point(e.Location.X, e.Location.Y), onPointer, toFill); break; } pointsToDraw.Clear(); pointsToDraw.Add(new Point(e.Location.X, e.Location.Y)); }