By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,475 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Crop/Zoom Image in Container

P: n/a
I want to allow my program users to:
1. Open a jpg inside of a panel control
(PictureBox control inside Panel control ... PictureBox picture set to
user's jpg file selection);
2. Zoom in and out on the jpg
(change the picturebox size mode to zoom and scale the photo);
3. Move the jpg up, down, left right within a container control
(using the MouseDown and MouseMove events, I change the location
of the jpg);
4. Save the visible portion, at its zoom level, as a new jpg.
(THIS IS MY PROBLEM)

I understand the DrawImage function and how it may be used to get a portion
of one image and "draw" it elsewhere. My problem is the coordinate system (I
think).

How do I specify the portion of the picture that is visible in the panel
(i.e., the source rectangle). My difficulty is compounded by the fact that
the image has been scaled.

Any help would be appreciated.

Thanks!

Mar 22 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Here is a link to a sample that will get you going. It's written with VB.Net
2002. But, should work.
james
http://www.gotdotnet.com/Community/U...0-E3D1CA40C74A

"DMCD" <DM**@discussions.microsoft.com> wrote in message
news:57**********************************@microsof t.com...
I want to allow my program users to:
1. Open a jpg inside of a panel control
(PictureBox control inside Panel control ... PictureBox picture set
to
user's jpg file selection);
2. Zoom in and out on the jpg
(change the picturebox size mode to zoom and scale the photo);
3. Move the jpg up, down, left right within a container control
(using the MouseDown and MouseMove events, I change the location
of the jpg);
4. Save the visible portion, at its zoom level, as a new jpg.
(THIS IS MY PROBLEM)

I understand the DrawImage function and how it may be used to get a
portion
of one image and "draw" it elsewhere. My problem is the coordinate system
(I
think).

How do I specify the portion of the picture that is visible in the panel
(i.e., the source rectangle). My difficulty is compounded by the fact that
the image has been scaled.

Any help would be appreciated.

Thanks!

Mar 23 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.