471,350 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Clipping a pic and saving it in a file in DOT NET

Hai

Im a newbie

I have a picture in a picture box

I drag a portion of the picture with the mouse.....

Here i get the area i dragged in and now i want that area to be a
separate picture saved in my hard disk

how do i do that?

i got two (x,y) co-ordinates where i started to drag and where i
finished dragging...

i got the width and height of the portion of the picture

how do i get the actual portion of the picture saved as a separate
file???

can anyone give me the code for that?

thanks in advance

Jan 30 '06 #1
4 1189
Dnia 30-01-2006 o 13:09:18 Dixon <vi********@gmail.com> napisał:
Hai

Im a newbie

I have a picture in a picture box

I drag a portion of the picture with the mouse.....

Here i get the area i dragged in and now i want that area to be a
separate picture saved in my hard disk

how do i do that?

i got two (x,y) co-ordinates where i started to drag and where i
finished dragging...

i got the width and height of the portion of the picture

how do i get the actual portion of the picture saved as a separate
file???

can anyone give me the code for that?

[PD]
1. Create second Image (Bitmap) with the size of (X2-X1), (Y2-Y1)
2. Create Graphics for it (Graphics.FromImage)
3. Draw correct portion of the source graphic to the destination graphic
(one of the Graphics.DrawImage methods allows you to do that)
4. Save the destination image (Image.Save)

--
Piotr Dobrowolski
Piotr.Dobrowolski@_usun_gmail.com
Jan 30 '06 #2
It doesnt work out

how do i set the size of the picture object its read only

my picture object is a bitmap object

?????

Jan 30 '06 #3

"Dixon" <vi********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...

Please do not crosspost questions to both .NET and non-.NET groups. The
*.vb.* groups are for VB6 and earlier. All .NET groups have "dotnet" in
their names.
Jan 30 '06 #4
Dnia 30-01-2006 o 15:10:56 Dixon <vi********@gmail.com> napisał:
It doesnt work out

how do i set the size of the picture object its read only

my picture object is a bitmap object

[PD] Bitmap destBitmap = new Bitmap(width,height);
--
Piotr Dobrowolski
Piotr.Dobrowolski@_usun_gmail.com
Jan 30 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by John Hunter | last post: by
14 posts views Thread by Doug van Vianen | last post: by
reply views Thread by phil cunningham | last post: by
2 posts views Thread by Pugi! | last post: by
9 posts views Thread by Andy Baxter | last post: by
6 posts views Thread by Serdar C. | last post: by

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.