Note that there are some explanatory texts on larger screens.

plurals
  1. POgetting System.Runtime.InteropServices.ExternalException!
    primarykey
    data
    text
    <p>I am trying to paint the image and save it by using the mouse click event. I added a button to undo the last paint operation. I am performing this operation by loading the previously saved image by mouse click event. I have a code here... I'll show the part where i get the exception in comments in the code:</p> <pre><code>private void pictureBox1_MouseClick(object sender, MouseEventArgs e) { rect.Width = 0; rect.Height = 0; pictureBox1.Invalidate(); pictureBox1.Image.Save(String.Format("{0}.Bmp",textBox2.Text )); //getting exception here!! int radius = 10; //Set the number of pixel you want to use here //Calculate the numbers based on radius int x0 = Math.Max(e.X - (radius / 2), 0), y0 = Math.Max(e.Y - (radius / 2), 0), x1 = Math.Min(e.X + (radius / 2), pictureBox1.Width), y1 = Math.Min(e.Y + (radius / 2), pictureBox1.Height); Bitmap bm = pictureBox1.Image as Bitmap; //Get the bitmap (assuming it is stored that way) for (int ix = x0; ix &lt; x1; ix++) { for (int iy = y0; iy &lt; y1; iy++) { bm.SetPixel(ix, iy, Color.Black); //Change the pixel color, maybe should be relative to bitmap } } pictureBox1.Refresh(); //Force refresh } </code></pre> <p>the code under button is:</p> <pre><code>private void button2_Click(object sender, EventArgs e) { pictureBox1.Load(string.Format("{0}.Bmp",textBox2.Text)); } </code></pre> <p>In my program I tried to save the image first and then painted it. When I click the button it is working &amp; loading the image, but when I again tried to paint it, there I am getting the exception. Please help where I need to change the code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload