0
votes

I'm making a signature application for my pocket pc. It works but when I test it with the emulator (mouse) it works like it should but when I try to test it on my device (stylus), the line that I draw is a little bit off where I am actually pointing too.

Anybody got an idea what it could be? Tried to find a solution on the internet but still nothing came up. Personally, I think it isn't the code but the pocket pc.. a configuration or something...

My code:

PictureBox1_MouseDown:

 x_md = e.X
 y_md = e.Y

PictureBox1_MouseMove:

 x_mm = e.X
 y_mm = e.Y
 Dim g As Graphics = Graphics.FromImage(bit)
 Dim myPen As Pen = New Pen(Color.Black, 2)
 g.DrawLine(myPen, x_md, y_md, x_mm, y_mm)
 PictureBox1.Image = bit
 x_md = x_mm
 y_md = y_mm

x_md, y_md, x_mm, Y_mm are all int16

King Regards

1
Not related to your drawing issue, but hopefully you are calling g.Dispose() at some point or you are going to give the .NET garbage collector a heart attack.Bradley Uffner
I didn't add the GC yet.. It needs to work proper before I do anything further like GC'ing..user3360972

1 Answers

0
votes

You're drawing on the image, but the mouse coordinates are on the picturebox. You can either draw on the picturebox or adjust the coordinates x_mm, y_mm to the offset and relative scale of the image.