Bitmap(string) constructor throws ArgumentException

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi
Im trying to create a bitmap on the fly from an on disk image resource (PNGs in this case).  I can create one fine, but when i try to create the next one the Bitmap constructor throws an ArgumentException with the message "Parameter is not valid".  The weird thing is that the second image (Pan2.png) is an exact duplicate of the first image (ZoomExtent.png) which creates successfully so there is no difference between the dimensions, color depth, format, etc of the two images.  Heres the suspect code below:<font size=2>
</font><font color="#0000ff" size=2>this</font><font size=2>.tsbFullExtent.DisplayStyle = System.Windows.Forms.</font><font color="#008080" size=2>ToolStripItemDisplayStyle</font><font size=2>.Image;
</font><font color="#0000ff" size=2>this</font><font size=2>.tsbFullExtent.Image = </font><font color="#0000ff" size=2>new</font><font size=2> </font><font color="#008080" size=2>Bitmap</font><font size=2>(</font><font color="#800000" size=2>@".ResourcesZoomExtent.png"</font><font size=2>); // Creates successfully
</font><font color="#0000ff" size=2>this</font><font size=2>.tsbPan.DisplayStyle = System.Windows.Forms.</font><font color="#008080" size=2>ToolStripItemDisplayStyle</font><font size=2>.Image;
</font><font color="#0000ff" size=2>this</font><font size=2>.tsbPan.Image = </font><font color="#0000ff" size=2>new</font><font size=2> </font><font color="#008080" size=2>Bitmap</font><font size=2>(</font><font color="#800000" size=2>@".ResourcesPan2.png"</font><font size=2>); // Throws ArgumentException</font>
<font size=2>Has anyone ever seen this before or have any insight at all?  Any help would be greatly appreciated.</font>
<font size=2>Thanks,</font>
Jeremy

View the full article
 
Back
Top