By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,718 Members | 1,840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,718 IT Pros & Developers. It's quick & easy.

Changing the cursor

P: n/a
Dom
I need to change the cursor when the mouse is hovering over certain
cells in a DataViewGrid, as a visual aid for the user. But the cursor
is not something found in the Cursors Class. I have a .ICO file.

What is the most efficient way of doing this? Is a way to build the
cursor resource right into the executable, so that it travels with
the EXE? That seems to be the way other programs do it. For example,
I have a resource viewer that lets me see all the resources in Excel,
and I can find Icons, Cursors, etc.

Right now, what I do is this. In the load event of the main window, I
do m_AlternateCursor = new Cursor (<AppStartupPath>\filename), and I
plan to include the ICO file in the executable folder.
Dec 31 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Dom,

That's what I would do. You wouldn't have to worry about the file being
changed or deleted (of course, it means you have to recompile if the cursor
changes).

You can just add the file to your project and set the compile action to
"embedded resource" and then you would call the GetManifestResourceStream
method on the Assembly class (the instance would represent the assembly you
are getting the embedded resource from). You could then pass that Stream to
the Cursor class, and use it appropriately.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dom" <do********@gmail.comwrote in message
news:4b**********************************@p69g2000 hsa.googlegroups.com...
>I need to change the cursor when the mouse is hovering over certain
cells in a DataViewGrid, as a visual aid for the user. But the cursor
is not something found in the Cursors Class. I have a .ICO file.

What is the most efficient way of doing this? Is a way to build the
cursor resource right into the executable, so that it travels with
the EXE? That seems to be the way other programs do it. For example,
I have a resource viewer that lets me see all the resources in Excel,
and I can find Icons, Cursors, etc.

Right now, what I do is this. In the load event of the main window, I
do m_AlternateCursor = new Cursor (<AppStartupPath>\filename), and I
plan to include the ICO file in the executable folder.

Dec 31 '07 #2

P: n/a
On Mon, 31 Dec 2007 09:46:09 -0800, Dom <do********@gmail.comwrote:
I need to change the cursor when the mouse is hovering over certain
cells in a DataViewGrid, as a visual aid for the user. But the cursor
is not something found in the Cursors Class. I have a .ICO file.

What is the most efficient way of doing this? Is a way to build the
cursor resource right into the executable, so that it travels with
the EXE?
Yes, just add a new Icon resource to the Resources of your project, using
the .ico file you have as the input.

You can then reference the icon from the Properties.Resources class of
your project.

I do agree that this is better than trying to include a separate file in
the same directory with your .exe, though assuming you're using a normal
Setup program to install the program, it shouldn't matter much which way
you do it since the user should never have to care about copying the files
manually.

Pete
Dec 31 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.