0

Im making a Drawing/Editing program. I have made a drawing tool, using this code on the MouseMove event:

If down = True Then
                Using br = New SolidBrush(Color.FromArgb(ColorA, ColorR, ColorG, ColorB))
                    GFX.FillEllipse(br, e.X, e.Y, size, size)
                End Using
            End If

GFX is graphics from a bitmap called IMG.

IMG is projected on a PictureBox.

The color integers are for the color channels, ColorA is for the alpha channel.

The down boolean is to check if the mouse is down.

SolidBrush br is the brush used to render the color of the stroke

e is MouseEventArgs

Now that I explained the code I will head on the problem that im facing:

My Problem

I tried to draw a cricle with the drawing tool and I've noticed the "dots" were spaced out. It seems its more spaced out if the mouse is moving at a fast speed.

Do I need to get the raw input from the mouse? I really don't know, so how do I fix this?

Thanks.

codiee
  • 31
  • 4
  • Have you tried drawing a line from the last position instead of an ellipse at the current position? – Andrew Morton May 29 '21 at 09:22
  • Good idea but how? – codiee May 29 '21 at 15:59
  • On the MouseDown event, store the mouse coordinates. On the MouseMove event, draw a line from the stored coordinates to the new mouse location, and store those new coordinates. – Andrew Morton May 29 '21 at 16:40
  • Free-hand using Bezier curves: [How to draw a signature and save it to disc as a Bitmap?](https://stackoverflow.com/a/57084653/7444103) -- Constrained by a specific shape or settings: [How to use the Paint event to draw shapes at mouse coordinates](https://stackoverflow.com/a/53708936/7444103), fixed ratio: [Drawing and scaling rectangle using a ratio](https://stackoverflow.com/a/54710125/7444103) – Jimi May 29 '21 at 17:27

0 Answers0