FromFile is not a member of the System.Drawing.Image

G

Guest

Hi

I was developing a Class for skinning an application. IN order to read the
image file dynamically I used System.Drawing.Image.FromFile("..."). Strangely
VS 2003 returns an error saying that "FromFile is not a member of the
System.Drawing.Image". According to the member list under IMage class that is
not true. I am completely baffled by the behaviour and stuck from past 2
days. Can anyone please help?

I have attached the function
Public Function validateImageLoad(ByVal xmlDoc As Xml.XmlDocument, ByVal
sFolder As String, ByVal picHolderArea As PictureBox, ByVal skinImageSection
As String, ByVal imageCollection As Collection) As Boolean
Dim resourceList As Xml.XmlNodeList
Dim resourceNode As Xml.XmlNode
Dim resourceNodeChild As Xml.XmlNode

Try

resourceList = xmlDoc.GetElementsByTagName(skinImageSection)

picHolderArea.Image =
System.Drawing.Image.FromFile("d:\WINCE420\PUBLIC\MovieEPG\Skins\main.jpg")

If (picHolderArea.Height = colImagesHeight(resourceNode.Name))
And (picHolderArea.Width = colImagesWidth(resourceNode.Name)) Then
imageCollection.Add(picHolderArea.Image, resourceNode.Name)
End If

Catch e As Exception
Console.Write("Error in validating the loading of image")
End Try

End Function

NOTE: I have updated the SDK .NET framework to 1.1 and also added the
service pack.

Thanks in advance
PJ
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?UEo=?= said:
I was developing a Class for skinning an application. IN order to read the
image file dynamically I used System.Drawing.Image.FromFile("..."). Strangely
VS 2003 returns an error saying that "FromFile is not a member of the
System.Drawing.Image". According to the member list under IMage class that is
not true.

'Image.FromFile' is not supported by the .NET Compact Framework.
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?UEo=?= said:
True I was using .NET Compact framework because I was develping this app as
a smart device application. However, I tried copying the class file into a
regular exe app and still it had trouble for what ever reason.

Is there a alternative to laod pictures in .NET Compact Framework?

\\\
Dim b As New Bitmap("C:\foo.bmp")
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top