enter image description hereI'm trying to create a drawing app that uses an image stored in the resources as a paintbrush The drawing will be depened on the location of the mouse and the mouse movement event The problem is when drawing quickly, there are spaces between an images of the drawing, as in the picture enter image description here the code of application
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace drawing_using_image
{
public partial class Form1 : Form
{
private Image image;
private Bitmap bm;
private Point ploc;
private Rectangle rec;
private bool ismouddown=false;
public Form1()
{
InitializeComponent();
image = Properties.Resources.angle45;
bm = new Bitmap(image, image.Width, image.Height);
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ploc = e.Location;
Graphics g = panel1.CreateGraphics();
rec = new Rectangle(ploc.X, ploc.Y, 45, 45);
Pen p = new Pen(Color.Black, 1);
g.DrawImage(image, rec);
}
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ismouddown = true;
}
}
}
}