Hi
I have image saved. Now i want that iy should be cropped from centre at the bottom and height 30 % from the bottom.
It should be displayed in PictureBox in Vb6
Thanks
Hi
I have image saved. Now i want that iy should be cropped from centre at the bottom and height 30 % from the bottom.
It should be displayed in PictureBox in Vb6
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Eliana BlakeRank #1,595 · 993 reputationPosted Mar 20, 2025, 11:02 AM EDT
It seems like you are looking to crop an image in VB6 from the center at the bottom and specifically to a height of 30% from the bottom. Here's an outline of how you can achieve this:
1. Load the image into a PictureBox control in VB6.
2. Calculate the dimensions for cropping the image to 30% height from the bottom:
- Determine the original height of the image.
- Calculate 30% of the height to get the cropping height.
- Set the cropping rectangle starting from the center at the bottom with the calculated height.
3. Use the PaintPicture method in VB6 to crop and display the image in the PictureBox.
Below is a simplified example based on the steps mentioned above to guide you in VB6:
Private Sub Form_Load() Dim img As StdPicture Set img = LoadPicture("your_image_path.jpg") ' Load your image ' Calculate cropping dimensions Dim originalHeight As Long Dim cropHeight As Long originalHeight = img.Height cropHeight = originalHeight * 0.3 ' 30% of the original height ' Set the cropping rectangle (center at the bottom) Dim cropRect As RECT cropRect.Left = 0 cropRect.Right = img.Width cropRect.Top = originalHeight - cropHeight cropRect.Bottom = originalHeight ' Crop and display the image in PictureBox1 PictureBox1.AutoRedraw = True PictureBox1.PaintPicture img, 0, 0, img.Width, img.Height, cropRect.Left, cropRect.Top, cropRect.Right, cropRect.Bottom PictureBox1.Refresh End SubMake sure to adjust the code to fit your specific requirements and image loading method in VB6.
I hope this helps you achieve the image cropping functionality you are looking for in VB6! If you have any further questions or need assistance with specific details, feel free to ask.