Member Avatar for nssltd

Hey well i am using microsoft visual c# 2008 professional edition and i seem to be having trouble using the cursor. The cursor i am using is one from axialis cursor workshop examples. it is a .cur and it does work as i have changed my windows default cursors to them. it is a colored cursor blue if you want to see it find it here
i have used various methods such as the msdn one

this.Cursor = new Cursor(GetType(), "a.cur");

and others but i just cant get it working instead i get this error

Object reference not set to an instance of an object.

for other methods i get this

Image format is not valid. The image file may be corrupted.Parameter name:stream

i get that error from

Cursor.Current = new Cursor("a.cur");

Any help would be much appreciated thanks in advance!

NSSLTD

Recommended Answers

All 4 Replies

HI,

To set the cursor image this is what I usually do and it works everytime:

IntPtr ptr = IMP.Properties.Resources.zoom_in.GetHicon();
Cursor c = new Cursor(ptr);
this.Cursor = c;

where the zoom_in is a bmp that i have saved in the resources of the project.

Regards

Member Avatar for nssltd

Hi thanks it does work but there is a problem with it. it doesn't work like a cursor as you need to move the WHOLE image over the component. is their anyway around this using a .cur/.ani instead of a .bmp?

thanks in advance

NSSLTD

Member Avatar for nssltd

Does anyone else know how to use either a .cur or a .ani instead any help is MUCH APPRECIATED ?

Thanks in advance

Member Avatar for nssltd

Dear anyone viewing this post. this post has been solved in another thread please go here to find out the answer.
HAPPY CODING!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.