Hi
I have below code and i want fromthe centre of Picture1 50 % should be displayed.
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
Picture1.Picture = Picture1.Image
Thanks
Eliana BlakePosted Mar 20, 2025, 4:21 PM
It seems like you are trying to display the center 50% of an image within Picture1. To achieve this, you can apply a cropping technique to focus on the central part of the image. Here's a simplified breakdown of how you could modify your code to crop and display the center 50% of the Picture1:
This code snippet enhances your existing code by adding a function `CropImage` that takes care of cropping the central 50% portion of the image loaded in Picture1. The dimensions and starting points are calculated to crop the image effectively. This implementation allows you to display the desired cropped area.
Please adjust the adjustments according to your specific requirements and the capabilities of the programming environment you are using. Let me know if you need further clarification or additional assistance!