473,324 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Crop/Zoom Image in Container

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
1 7182
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Kevin Smith | last post by:
Is there a way to "auto-crop" an image in PIL? I have some PNG images with white backgrounds that I want cropped to show only the non-white portion in the center, but I don't see how I can do...
3
by: ACaunter | last post by:
Hi there, I was wondering if there was a way to crop a peice of an ASP.Net Image, allowing the user to zoom in on only a section of the picture?? any help would be appreciated!! thanks --...
6
by: Rich | last post by:
Hello, I am putting together a simple picture viewing program to view jpg. bmp pictures. I have the picturebox sizemode set to autosize. I have the picturebox in a pannel set to autoscroll, so...
3
by: Keith G Hicks | last post by:
In MS Access image controls there's a property setting for "Size Mode" --> Clip, Zoom or Stretch. I don't see any similar property in an asp image control. When I have an image on a page, it seems...
0
by: murry19830507 | last post by:
i want creat an web application(c#.net),which contains an image and one radiobutton list with 3 radiobuttons(zoom in ,zoom out ,zoom window) when user checked on zoom in imge has to be zoom inthe...
1
Thekid
by: Thekid | last post by:
Hi, I have an image similar to a clock, with numbers and letters going around in a circle. I need to extract the numbers and letters from the image and have them print out in a straight line and in...
3
by: fuchsia555 | last post by:
hi is there a code to crop bottom border from an image when creating thumbnail for this image without crop the original image , but just crop 15px bottom border for creating the thumbnails for the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.