KingSencat
asked on
How Do I Save A Portion Of A PictureBox?
Hi experts, How Do I Save A Portion Of A PictureBox? Any examples?
ASKER
VB6 or VB.Net? (If .net, which version?)
- I use VB6.0
Is ALL of the "picture" in the Image/Picture Property?...or is some of it being rendered "on top" in the Paint() Event?
- Didn't understand what your trying to say.
Lets say that i loaded a picture into the picturebox1. Now all i want to do is to take a portion of that picture and save it on a second picturebox or to a .bmp file. How can i accomplish that?
- I use VB6.0
Is ALL of the "picture" in the Image/Picture Property?...or is some of it being rendered "on top" in the Paint() Event?
- Didn't understand what your trying to say.
Lets say that i loaded a picture into the picturebox1. Now all i want to do is to take a portion of that picture and save it on a second picturebox or to a .bmp file. How can i accomplish that?
You want the PaintPicture() method:
http://msdn.microsoft.com/en-us/library/aa244140(VS.60).aspx
Something like:
Picture2.PaintPicture Picture1.Picture, 0, 0, 50, 50, 100, 10, 50, 50
That would take the 50x50 portion at (100, 10) in Picture1 and paint it at (0, 0) in Picture2 within a 50x50 box. Since the sizes are the same, this would be a straight copy and no stretching would occur.
http://msdn.microsoft.com/en-us/library/aa244140(VS.60).aspx
Something like:
Picture2.PaintPicture Picture1.Picture, 0, 0, 50, 50, 100, 10, 50, 50
That would take the 50x50 portion at (100, 10) in Picture1 and paint it at (0, 0) in Picture2 within a 50x50 box. Since the sizes are the same, this would be a straight copy and no stretching would occur.
ASKER
I try to use
Picture2.PaintPicture Picture1.Picture, 0, 0, 50, 50, 100, 10, 50, 50
And i get invalid picture error message, why? Do i have to declare anything?
Picture2.PaintPicture Picture1.Picture, 0, 0, 50, 50, 100, 10, 50, 50
And i get invalid picture error message, why? Do i have to declare anything?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is ALL of the "picture" in the Image/Picture Property?...or is some of it being rendered "on top" in the Paint() Event?