R
Roy Chastain
I have a bitmap file that I added to the project and said that it was to be an embedded resource.
I have used the code provided by a couple of people in the NGs that uses GetManifestResourceStream and am having problems.
This code works
System.Drawing.Image splash_image;
splash_image = Image.FromFile("HGSSplash.bmp");
splash = new SplashForm(splash_image,Color.Red,typeof(ConfigUtility));
splash.ShowSplash(7);
This code does not work
System.IO.Stream stream;
System.Drawing.Image splash_image;
SplashForm splash;
stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("KMS.HGS.Forms.ConfigUtility.HGSSplash.bmp");
splash_image = Image.FromStream(stream);
stream.Close();
splash = new SplashForm(splash_image,Color.Red,typeof(ConfigUtility));
splash.ShowSplash(7);
Simply replacing
splash_image = Image.FromStream(stream);
with
splash_image = Image.FromFile("HGSSplash.bmp");
will fix the problem.
Now the failure is really interesting. It is an Out of Memory Exception that is happening in
System.Drawing.TextureBrush..ctor(Image image, WrapMode wrapMode)
None of my code (SplashForm and it helpers etc) creates a TextureBrush
At least part of the image is working correctly. One thing that happens in this SplashForm is that a transparent area is clipped
out. Even when the Out Of Memory is thrown, the outline of the clipped image is displayed with a BIG RED X across it. The
outline is correct, which makes me think that the image is being properly loaded.
Any ideas?
Thanks
I have used the code provided by a couple of people in the NGs that uses GetManifestResourceStream and am having problems.
This code works
System.Drawing.Image splash_image;
splash_image = Image.FromFile("HGSSplash.bmp");
splash = new SplashForm(splash_image,Color.Red,typeof(ConfigUtility));
splash.ShowSplash(7);
This code does not work
System.IO.Stream stream;
System.Drawing.Image splash_image;
SplashForm splash;
stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("KMS.HGS.Forms.ConfigUtility.HGSSplash.bmp");
splash_image = Image.FromStream(stream);
stream.Close();
splash = new SplashForm(splash_image,Color.Red,typeof(ConfigUtility));
splash.ShowSplash(7);
Simply replacing
splash_image = Image.FromStream(stream);
with
splash_image = Image.FromFile("HGSSplash.bmp");
will fix the problem.
Now the failure is really interesting. It is an Out of Memory Exception that is happening in
System.Drawing.TextureBrush..ctor(Image image, WrapMode wrapMode)
None of my code (SplashForm and it helpers etc) creates a TextureBrush
At least part of the image is working correctly. One thing that happens in this SplashForm is that a transparent area is clipped
out. Even when the Out Of Memory is thrown, the outline of the clipped image is displayed with a BIG RED X across it. The
outline is correct, which makes me think that the image is being properly loaded.
Any ideas?
Thanks