Hi
I want to Save Cropped Picture in App.Path folder. Below is the code
Dim lSourceX As Long, lSourceY As Long
Dim lOldWidth As Long, lOldHeight As Long
Dim lNewWidth As Long, lNewHeight As Long
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture(App.Path & "\O_" & tno & ".jpg")
Picture1.Width = Picture1.Picture.Width
Picture1.Height = Picture1.Picture.Height
Dim originalPic As PictureBox
Dim croppedPic As PictureBox
Set originalPic = Picture1 ' Set your source PictureBox
Set croppedPic = Picture2 ' Set your destination PictureBox
Dim centerX As Long, centerY As Long
centerX = 25000
centerY = 14000
' Calculate top-left coordinates for cropping (3000x3000)
Dim cropX As Long, cropY As Long
cropX = centerX - (3000 \ 2)
cropY = centerY - (3000 \ 2)
' Ensure Picture2 is properly sized
croppedPic.Width = 3000
croppedPic.Height = 3000
' Copy the cropped section from Picture1 to Picture2
BitBlt croppedPic.hDC, 0, 0, 3000, 3000, originalPic.hDC, cropX, cropY, SRCCOPY
croppedPic.PaintPicture originalPic.Picture, 0, 0, 3000, 3000, cropX, cropY
Thanks