Im trying to save image from inside pictureBox1 to my hard disk not working good

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chocolade
    New Member
    • Aug 2010
    • 69

    Im trying to save image from inside pictureBox1 to my hard disk not working good

    When i click a button and paintDemoMode is true then its showing this rectToDrawOut as rectangle on the pictureBox1

    Now i want to save to my hard disk the image show now in the pictureBox1 including the rectangle.

    But its aving just the image from the pictureBox1 without the rectangle. I tried also instead pictureBox1.Ima ge.Save i tried bb.Save but again it didnt save the rectangle. whats wrong here ?


    In the pictureBox1_Pai nt event im drawing the rectangle if its needed this is the code:

    Code:
    if (paintDemoMode == true)
    {
        Bitmap bmp = new Bitmap(combinedTemp);
        Bitmap bb = new Bitmap(bmp);
        bmp.Dispose();
        bmp = null;
    
    
        if (pictureBox1.Image != null)
        {
    	pictureBox1.Image.Dispose();
    	pictureBox1.Image = null;
        }
    
        pictureBox1.Image = bb;
        image_scan_text_rect = new Rectangle(25, 240, 341, 39);
        float x = ((float)image_scan_text_rect.X / bb.Width) * (float)this.pictureBox1.Width;
        //float y = ((float)Rect.Y / this.pictureBox1.ClientSize.Height) * (float)FirstImage.Height;
        float y = ((float)image_scan_text_rect.Y / bb.Height) * (float)this.pictureBox1.Height;
        //float newRight = ((float)Rect.Right / (float)pictureBox1.ClientSize.Width) * ((float)FirstImage.Width); 
        float newRight = ((float)image_scan_text_rect.Right / bb.Width) * (float)pictureBox1.Width;
        //float newBottom = ((float)Rect.Bottom / (float)pictureBox1.ClientSize.Height) * ((float)FirstImage.Height);
        float newBottom = ((float)image_scan_text_rect.Bottom / bb.Height) * (float)pictureBox1.Height;
        rectToDrawOut = new RectangleF(x, y, newRight - x, newBottom - y);
        pictureBox1.Image.Save(@"d:\testit.png", System.Drawing.Imaging.ImageFormat.Png);
    }
    return;
    Last edited by Niheel; Sep 7 '11, 06:46 AM.
Working...