Loading animated cursor resource

B

Bubbles Van

I'm trying to load an animated cursor resource directly from the exe file.
I have added it in into the assembly and set it's build action to embedded
resource.

I have a function written as follows:

Private Function GetResCursor(ByVal strIdentifier As String) As Cursor
Return New
Cursor([Assembly].GetExecutingAssembly().GetManifestResourceStream(strIdenti
fier))
End Function

When I call the function with the following:
m_BusyCursor = GetResCursor("FileSearch.cross.cur")
everything works just fine and I'm able to change the cursor.

However, when I call GetResCursor with this:
m_BusyCursor = GetResCursor("FileSearch.busy.ani")
and specify an animated cursor, I receive the following exception:

An unhandled exception of type 'System.ArgumentException' occurred
in system.windows.forms.dll
Additional information: Invalid image format. The image file may be
corrupt.

I know the image isn't corrupt as I'm able to use this animated cursor file
under mouse properties.

Any suggestions???

Thanks

Brant
 
A

Armin Zingler

Bubbles Van said:
However, when I call GetResCursor with this:
m_BusyCursor = GetResCursor("FileSearch.busy.ani")
and specify an animated cursor, I receive the following exception:

An unhandled exception of type 'System.ArgumentException'
occurred
in system.windows.forms.dll
Additional information: Invalid image format. The image file
may be
corrupt.

See the docs for the Cursor class. Animated cursors are not supported.
 

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