Hi,
I am writing a program in VB6 where an image is loaded into a picture box if I print this image it is exactly where I expect it to be.
The problem is I need to be able to draw lines on the image in the picture box.
This works fine on the screen but when I then print the image has moved diagonally towards the top left corner of the picturebox.
I am sure the problem is with the line drawing code but can not work out why it is moving the image when printing.
the drawing code is below :-
- Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
-
-
'Releases last line if right mouse button is pushed
-
If Button = 2 Then
-
'Erases current Line
-
Picture1.Line (X1, Y1)-(X2, Y2)
-
'Reset line vaiables
-
X2 = 0
-
Y2 = 0
-
LineOn = False
-
Exit Sub
-
End If
-
'If the LineOn Flag is true
-
If LineOn Then
-
'Erase the Stretch Line
-
Picture1.Line (X1, Y1)-(X2, Y2)
-
'Turn inverted draw off
-
Picture1.DrawMode = 13
-
-
X2 = X
-
Y2 = Y
-
-
'Draw the final line
-
Picture1.Line (X1, Y1)-(X2, Y2), RGB(0, 255, 0)
-
'Set new start line points
-
-
X1 = X2
-
Y1 = Y2
-
-
X1 = X
-
Y1 = Y
-
-
-
If LineOn <> 1 Then
-
X2 = 0
-
Y2 = 0
-
LineOn = False
-
Exit Sub
-
End If
-
Else
-
'The line has not been drawn yet
-
-
X1 = X: Y1 = Y
-
-
'Set end values
-
X2 = X
-
Y2 = Y
-
LineOn = True
-
End If
-
Picture1.DrawMode = 6
-
Picture1.DrawStyle = 6
-
X3 = X: Y3 = Y: X4 = X: Y = Y4
-
End Sub
-
-
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
-
'Draw the stretch or rubberband line
-
If LineOn Then
-
Picture1.AutoRedraw = True
-
Picture1.Line (X1, Y1)-(X2, Y2)
-
X2 = X
-
Y2 = Y
-
Picture1.Line (X1, Y1)-(X, Y)
-
-
-
End If
-
End Sub
I hope someone can help with this as it is driving me mad
Dave