TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tal Kraus
NA
3
2.3k
Displaying image from list and saving it to disk
Mar 28 2011 6:20 PM
Hi I am trying to do the following two things.
1. To display a specific image from a list. Problem: I always get the first cropped part stored not the last as in the example.
2. To save the image into disk. Problem: No file is genrated on disk.
Please carefully examine the code:
//evertime the picture is cropped the mouseup event will run
public
void
ImageBox_MouseUp(
object
sender,
MouseEventArgs
e)
if
(
this
.drawingRectangle)
this
.areas.Add(
this
.rect);
this
.drawingRectangle =
false
;
{
Bitmap
cropped =
new
Bitmap
(rect.Width, rect.Height);
Graphics
g =
Graphics
.FromImage(cropped);g.DrawImage(bm,
new
Rectangle
(0, 0, cropped.Width, cropped.Height), rect.X, rect.Y, cropped.Width, cropped.Height,
GraphicsUnit
.Pixel);
this
.CroppedImages.Add(bm);
pictureBox3.Image = CroppedImages.Last(); //This shows only the first cropped file, not the last one
pictureBox3.Image.Save(
"c:\\program files\\image.jpeg"
); // This doesn't do anything no file is created
cropped.Dispose();
g.Dispose();
}
Thanks in advance
Reply
Answers (
2
)
MetaData in an Excel Cell
Media Player EgyMedia Player v3