H
Hugh Creswell
Hi there - I hope someone can help with this problem....
A colleague and myself are trying to load a PictureControl (using C#)
from a GIF file. We don't want to set the file in the resource
properties, as the file is generated on the fly, and placingthe
filename in the properties appears to embed the file in the resources,
hence not changig unles we re-compile.
The GIF file has been creating using the Excel export method.
The code we are using to load the file is :-
this.pictureBox_DefectCountView.Image =
System.Drawing.Image.FromFile("count.gif");
The file exists, and is openable by other apps - MSpaint, PSP, etc
etc.
However, whenever we call that line of code, it throws an exception,
"Invalid Parameter".
We have tried variations on a theme, such as giving absolute paths,
loading as a BMP file. We have also tried creating a new Bitmap using
:-
Bitamp theBmp = new Bitmap("count.gif");
This also throws the exception.
I've done a google for "C# FromFile Gif Bitmap" and had a look at the
result, and they all seem to suggest that we are trying to do the
right thing...
Has anybody any ideas?
Thanks in advance
A colleague and myself are trying to load a PictureControl (using C#)
from a GIF file. We don't want to set the file in the resource
properties, as the file is generated on the fly, and placingthe
filename in the properties appears to embed the file in the resources,
hence not changig unles we re-compile.
The GIF file has been creating using the Excel export method.
The code we are using to load the file is :-
this.pictureBox_DefectCountView.Image =
System.Drawing.Image.FromFile("count.gif");
The file exists, and is openable by other apps - MSpaint, PSP, etc
etc.
However, whenever we call that line of code, it throws an exception,
"Invalid Parameter".
We have tried variations on a theme, such as giving absolute paths,
loading as a BMP file. We have also tried creating a new Bitmap using
:-
Bitamp theBmp = new Bitmap("count.gif");
This also throws the exception.
I've done a google for "C# FromFile Gif Bitmap" and had a look at the
result, and they all seem to suggest that we are trying to do the
right thing...
Has anybody any ideas?
Thanks in advance