Displaying image from list and saving it to disk
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
Answers (2)
0
Hello Stefan,
Thanks for fast response. It works like a charm ;)
0
First, your English if fine. I didn't notice a single mistake
I had the same problem and I din't come up with quite a civilized solution but it works. In the javascript method that submits the data I loop through the items in the list box and form a string containing a coma separated list (you'd better not allow comas in the items values (-; ), pass it to the server through a hidden input and then parse it on the server. The code is something like:
javscript:
function showCity(){
var result = new String();
var resultText = new String();
//alert("we're in");
for(i=0;i