Hi
How to convert the below code in Module. Code is in VB6
Private Sub Image_Crop()
Dim lSourceX As Long, lSourceY As Long
Dim lOldWidth As Long, lOldHeight As Long
Dim lNewWidth As Long, lNewHeight As Long
' -=[ Convert to Pixels ]=-
lOldWidth = Picture1.ScaleWidth \ Screen.TwipsPerPixelX
lOldHeight = Picture1.ScaleHeight \ Screen.TwipsPerPixelY
' -=[ Calculate 70% of Width and Height ]=-
lNewWidth = lOldWidth * 0.7
lNewHeight = lOldHeight * 0.7
' -=[ Calculate Top Left of centered image ]=-
lSourceX = (lOldWidth - lNewWidth) \ 2
lSourceY = (lOldHeight - lNewHeight) \ 2
' -=[ Resize Destination Picture ]=-
Picture2.Width = Picture2.Width - Picture2.ScaleWidth + (lNewWidth * Screen.TwipsPerPixelX)
Picture2.Height = Picture2.Height - Picture2.ScaleHeight + (lNewHeight * Screen.TwipsPerPixelY)
' -=[ Crop Image ]=-
BitBlt Picture2.hDC, 0&, 0&, lNewWidth, lNewHeight, Picture1.hDC, lSourceX, lSourceY, SRCCOPY
' -=[ VB Equivalent: Values not converted to pixels ]=-
'Picture2.PaintPicture Picture1.Picture, 0, 0, lNewWidth, lNewHeight, lSourceX, lSourceY
Picture2.Refresh
End Sub
Thanks