Geni Lou

Geni Lou

  • NA
  • 101
  • 22.2k

Smooth brush in drawing

Jan 28 2022 8:46 AM

Hi I use this code to draw..

private void imgDrawing_MouseUp(object sender, MouseEventArgs e){
   lastPoint   = Point.Empty;
   isMouseDown = false;
  isMouseMove = false;}

private void imgDrawing_MouseMove(object sender, MouseEventArgs e){
 if (isMouseDown == true){
   if (lastPoint != null){
if (picDrawing.Image == null){
   Bitmap bmp = new Bitmap(picDrawing.Width, picDrawing.Height);
   picDrawing.Image = bmp;
}

isMouseMove = true;

using (Graphics g = Graphics.FromImage(picDrawing.Image)){
   g.DrawLine(new Pen(brushColor, 7), lastPoint, e.Location);
   g.SmoothingMode = SmoothingMode.HighQuality;}

  picDrawing.Invalidate();
  lastPoint = e.Location;}
}}

But the result is like this. Is it possible to make it smoother or something that is continous unlike the image below..


Answers (1)