I created some code that uses the stretchblt api to skew an image to the right or to the left but when I am skewing the image to the right it messes up just a bit, I included the code for any one to try out and see what is happening. could any help me out on this?

'You need 2 picture boxes named Picture1 and Picture2 and 2 command buttons named Command1 and Command2

'code for left skew
'put a pic in picture1 and set picture1's autoredraw to false

Private Sub Command1_Click()
Dim Y1, X1, Y2, X2
Do Until Y2 = Picture2.ScaleHeight
X2 = X2 + 1
Y2 = Y2 + 1

StretchBlt Picture2.hdc, 0, Y2, Picture2.ScaleWidth, 1, _
Picture1.hdc, 0, Y2, Picture1.ScaleWidth - (X2 * 7), 1, SRCCOPY '(x2 * 7) the 7 sets amount of skew
Loop
Picture2.Refresh
End Sub


'code for right skew

Private Sub Command2_Click()
Dim Y1, X1, Y2, X2

Do Until Y2 = Picture2.ScaleHeight
X2 = X2 + 1
Y2 = Y2 + 1

po = ((Picture1.ScaleWidth - (Picture1.ScaleWidth / Screen.TwipsPerPixelX)) + (X2 * 8) / Screen.TwipsPerPixelX) - Picture2.ScaleWidth
' po should = the amount of Picture2.scalewidth - X2 (When X2 is at its Peek #) ""This is what I am haveing trouble with, My brain is fryed""

StretchBlt Picture2.hdc, 0, Y2, Picture2.ScaleWidth, 1, _
Picture1.hdc, 0, Y2, (Picture1.ScaleWidth - (Picture1.ScaleWidth / Screen.TwipsPerPixelX) - po) + (X2 * 8), 1, SRCCOPY

'(Picture1.ScaleWidth / Screen.TwipsPerPixelX) - po) sets how far right the image goes
'(X2 * 8) sets how far to skew left

Loop
Picture2.Refresh
End Sub

I am prob. using to much code for the math on the right skew, if any one can find out how to fix my wacky code please post or email me.

Thank you,
Jeremy H.


------------------
Dafly98@aol.com

[This message has been edited by Dafly (edited 12-11-1999).]