Hi
I want to load image as picoriginal . I want user should able to select a portion of it & then save it as cropped image in another picture box
I want cod ein Vb6
Thanks
Hi
I want to load image as picoriginal . I want user should able to select a portion of it & then save it as cropped image in another picture box
I want cod ein 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 attend5days leftRegister
Sophia CarterRank #4,018 · 371 reputationPosted Mar 18, 2025, 8:37 AM EDT
Hello! I'd be happy to assist with your inquiry on cropping images using Vb6. To achieve this functionality in Vb6, you can follow these steps:
1. Load the original image into a picture box:
You can use Vb6 code like the following to load an image into a picture box named 'picOriginal':
picOriginal.Picture = LoadPicture("Path_to_your_image_file.jpg")2. Allow the user to select a portion of the image:
You can use Vb6's built-in selection tools or create custom selection functionality using mouse events such as MouseDown, MouseMove, and MouseUp on the 'picOriginal' picture box.
3. Once the user selects the desired portion, you can crop the image:
To crop the selected portion of the image, you'll need to create a new Bitmap object, copy the selected portion onto this new Bitmap, and then assign this cropped image to another picture box for display. Here's a simplified example:
Dim croppedImage As StdPicture Dim selectedRect As Rect ' Define selectedRect based on user's selection ' Create a new Bitmap and copy the selected portion Set croppedImage = CreateBitmap(selectedRect.Width, selectedRect.Height) BitBlt picCropped.hDC, 0, 0, selectedRect.Width, selectedRect.Height, picOriginal.hDC, selectedRect.Left, selectedRect.Top, SRCCOPY ' Assign the cropped image to another picture box named 'picCropped' picCropped.Picture = croppedImage4. You can then provide functionality for the user to save the cropped image if needed.
Remember to handle error checking, boundary conditions, and user interactions to ensure a smooth experience. If you have any specific questions or need further clarification, feel free to ask. Happy coding in Vb6!