Custom Cursors on Custom Controls

G

Guest

Hi all, newbie here.
I'm currently designing a custom splitter control...
When the mouse hovers over a certain area on my splitter I need to be able
to display a custom cursor that I've designed.

I've tried several ways to assign my custom cursor to a cursor variable, the
most obvious being by the filename:
myCursor = new Cursor("c:\\myCursor.cur");
and then assign it as the current cursor when in position:
Cursor.current = myCursor
However when I do this the cursor displayed is Ibeam cursor and not my
cursor !!

I've also tried assigning the cursor by changing the Build Action property
on my cursor file to 'Embedded Resource' then loading as such:
myCursor = new Cursor(GetType(), "myCursor.cur");
This causes a an unhandled exception with info 'Value cannot be null". I
assume this is referring to the GetType() ????

I've also tried to do this using a resource manager:
ResourceManager resources = new ResourceManager(typeof(MySplitter));
myCursor = (Cursor)resources.GetObject("myCursor.cur");
But when I do this there is no cursor displayed at all when I change the
current cursor to 'myCursor'.

Any ideas where I'm going wrong chaps?

Thanks in advance
 
M

Mick Doherty

\\\
Private myCursor as Cursor = New Cursor(Me.GetType, "myCursor.cur")
///
assign the cursor:
\\\
Cursor = myCursor
///
reset the cursor:
\\\
Cursor = Nothing
///
 

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