sambo
May 26th, 2006, 01:10 AM
I am loading a bitmap from a file and using it as the background image of my form.
string sBitmapFullPath = @"C:\picture.bmp";
Bitmap bm = new Bitmap(sBitmapFullPath);
Color col = bm.GetPixel(1, 1);
this.Width = bm.Width;
this.Height = bm.Height;
this.BackgroundImage = bm;
At some point later I try to modify the file C:\picture.bmp, but the file is locked. After I call Bitmap.Dispose, I can modify the file. Is there any way that I can modify the file while it is still locked? I tried to use Bitmap.Clone image, but that didn't work either. Any ideas?
Basically, I want to change the image used for my form background, but I want it to use the same file path.
string sBitmapFullPath = @"C:\picture.bmp";
Bitmap bm = new Bitmap(sBitmapFullPath);
Color col = bm.GetPixel(1, 1);
this.Width = bm.Width;
this.Height = bm.Height;
this.BackgroundImage = bm;
At some point later I try to modify the file C:\picture.bmp, but the file is locked. After I call Bitmap.Dispose, I can modify the file. Is there any way that I can modify the file while it is still locked? I tried to use Bitmap.Clone image, but that didn't work either. Any ideas?
Basically, I want to change the image used for my form background, but I want it to use the same file path.