improved life cycle management of picturebox images (dont we have some direct substitute for picturebox which doesnt suck so much?)

This commit is contained in:
zeromus 2014-08-14 15:51:49 +00:00
parent 6ad6126536
commit dd8638ba06
1 changed files with 14 additions and 0 deletions

View File

@ -53,9 +53,23 @@ namespace BizHawk.Client.EmuHawk
bmp.SetPixel(i, j, col);
}
}
if (pictureBox1.Image != null) pictureBox1.Image.Dispose();
pictureBox1.Image = bmp;
}
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
if (pictureBox1.Image != null)
{
pictureBox1.Image.Dispose();
pictureBox1.Image = null;
}
}
private void buttonPal_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog