Im trying to save now the image inside the pictureBox1 to my hard disk but its saving it without the rectangle inside the pictureBox1 why?
<pre><code>if (ImagesComparion1.ImageComparison(File1, file2, image_scan_text_rect) == true)
                                            {
                                               /* Logger.Write("File1 is &gt;&gt;&gt;&gt; " + combinedTemp);
                                                // Logger.Write("File2 is &gt;&gt;&gt;&gt; " + fi.FullName);
                                                Logger.Write("Last File is &gt;&gt;&gt;&gt; " + last_file);
                                                Logger.Write("image_scan_text_rect values are &gt;&gt;&gt;&gt;&gt; " + image_scan_text_rect.ToString());
                                                Logger.Write("ImagesComparion1.ImageComparison(File1, file2, image_scan_text_rect) is now true");*/
                                                if (pictureBox1.Image != null)
                                                {
                                                    pictureBox1.Image.Dispose();
                                                    pictureBox1.Image = null;
                                                }
                                                pictureBox1.Load(last_file);
                                                File1.Dispose();
                                                Properties.Resources.RadarImageClose.Dispose();
                                                label18.Text = "The Radar Is Not Active Now";
                                                label18.Visible = true;

                                                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;
                                            }
</code></pre>

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

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

<p>But its aving just the image from the pictureBox1 without the rectangle. I tried also instead pictureBox1.Image.Save i tried bb.Save but again it didnt save the rectangle. whats wrong here ?</p>

<p>In the pictureBox1_Paint event im drawing the rectangle if its needed this is the code:</p>

<pre><code>private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            using (Pen pen = new Pen(Color.Red, 2))
            {
                if (paintDemoButtonSwitch == true)
                {
                                        e.Graphics.DrawRectangle(pen, rectToDrawOut.X, rectToDrawOut.Y, rectToDrawOut.Width, rectToDrawOut.Height);
                                    }
            }
        }
</code></pre>

<p>Thanks for helping.</p>
