Hi
With this code it is displating image from centre of the right side. I want that it should displat the centre of Picture1 image.
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, ByVal ySrc As Long, _
ByVal dwRop As Long) As Long
Const SRCCOPY = &HCC0020
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture(App.Path & "\O_" & tno & ".jpg")
Picture1.Width = Picture1.Picture.Width
Picture1.Height = Picture1.Picture.Height
Picture1.Picture = Picture1.Image
' -=[ Convert to Pixels ]=-
lOldWidth = Picture1.ScaleWidth \ Screen.TwipsPerPixelX
lOldHeight = Picture1.ScaleHeight \ Screen.TwipsPerPixelY
' -=[ Calculate 70% of Width and Height ]=-
lNewWidth = lOldWidth * 0.5
lNewHeight = lOldHeight * 0.5
' -=[ Calculate Top Left of centered image ]=-
lSourceX = (lOldWidth - lNewWidth) \ 2
lSourceY = (lOldHeight - lNewHeight) \ 2
Picture2.Width = Picture2.Width - Picture2.ScaleWidth + (lNewWidth * Screen.TwipsPerPixelX)
Picture2.Height = Picture2.Height - Picture2.ScaleHeight + (lNewHeight * Screen.TwipsPerPixelY)
BitBlt Picture2.hDC, 0&, 0&, lNewWidth, lNewHeight, Picture1.hDC, lSourceX, lSourceY, SRCCOPY
Thanks