nwmark$2007042
nwmark

02/12/2007 :: 16:37

Registered

Im drawing a line using the following line of code which is in the mouseup event of the oGDViewer control.

oGdPicture.DrawLine(StartX, StartY, e.x, e.y, 10, oGdPicture.ColorGetARGBValueFromARGB(255, 255, 0, 0), True)

StartX, StartY are taken from the MouseDown event.

My problem is that the line doesnt appear where i click, its always to the left and if the image is scrollable (i.e. image bigger than the control) then the line is usually longer than it should be. If i fit the image to the size of the control using zoommode 2 then the line is shorter than it should be.

I presume it something to do with im taking the co-ordinates from the control, but its drawing the line at those co-ordinate on the image file so they dont match.

Any Ideas how i can get the line to appear where i click?

Cheers

Mark
Loïc$2006306
Loïc

02/13/2007 :: 14:00

Registered

Hi,

The MouseDown Events parameters returns the Mouse position into the control and not into the image.
To get the Image position use the GetMouseX() and the GetMouseY() methods in this same event.

Best regards,

Loïc Carrère
nwmark$2007042
nwmark

02/13/2007 » 14:40

Registered

Many thanks

That works superbly.

Mark
back to forum