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

How to implement custom mouse cursor

P: n/a
Rud
I'm still searching for an easy way to implement customized mouse pointers.
I've searched in the help text but couldn't get the answer. Do I have to dig
into the creation of resource files or is there a better alternative? Can I
use an imagelist like:

panel.cursor = imagelist.listimages(1) or something like this???

Kind regards, Rud
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Rud" <rudvb6@h@menl.nl> schrieb:
I'm still searching for an easy way to implement customized
mouse pointers. I've searched in the help text but couldn't
get the answer. Do I have to dig into the creation of resource
files or is there a better alternative?


This should work by embedding the cursor as a resource. The code in the
post referenced below demonstrates how to load an icon from the resources,
you can easily change it to work with cursor files by replacing 'Icon' with
'Cursor':

<URL:http://www.google.de/groups?selm=OIoCi89qEHA.3988%40tk2msftngp13.phx.gb l>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #2

P: n/a
Hi,

Add the cursor to the application and set its build action to
embedded resource. Here is an example that uses the pencil.cur included
with vs.net.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim p As System.Reflection.Assembly =
System.Reflection.Assembly.GetExecutingAssembly()

Dim cur As Cursor

cur = New Cursor(p.GetManifestResourceStream(Me.GetType, "PENCIL.CUR"))

Me.Cursor = cur

End Sub

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

Me.Cursor = Cursors.Default

End Sub

Ken

-------------------------

"Rud" <rudvb6@h@menl.nl> wrote in message
news:cl**********@news1.zwoll1.ov.home.nl...
I'm still searching for an easy way to implement customized mouse pointers.
I've searched in the help text but couldn't get the answer. Do I have to dig
into the creation of resource files or is there a better alternative? Can I
use an imagelist like:

panel.cursor = imagelist.listimages(1) or something like this???

Kind regards, Rud

Nov 21 '05 #3

P: n/a
Rud
Thanks for your help! So the trick is to set the "Build Action" of the
cursor file to "Embedded Rource" such that I can load the icons in the load
event of the form as follows:

curDefault = New Cursor(Me.GetType(), "cDefault.ico")

Rud

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl...
"Rud" <rudvb6@h@menl.nl> schrieb:
I'm still searching for an easy way to implement customized
mouse pointers. I've searched in the help text but couldn't
get the answer. Do I have to dig into the creation of resource
files or is there a better alternative?


This should work by embedding the cursor as a resource. The code in the
post referenced below demonstrates how to load an icon from the resources,
you can easily change it to work with cursor files by replacing 'Icon'
with 'Cursor':

<URL:http://www.google.de/groups?selm=OIoCi89qEHA.3988%40tk2msftngp13.phx.gb l>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.