473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to implement custom mouse cursor

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
3 7184
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom Alcendor | last post by:
I am building a chess game application that allows a user to click on a piece and move it to a new square. When the user clicks on a piece the mouse pointer must change to the image associated...
3
by: Simon Wigzell | last post by:
I have an image with several links in it in mapped areas. I am using a custom cursor on the page and would like to have a custom cursor appear on mouse over of the mapped links. Something like: ...
2
by: Brad | last post by:
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....
15
by: Tinus | last post by:
Hello all, I've created a custom control that draws a monthly schedule (using the Draw function in C#). Basically it draws 31 boxes and writes the day number in every box. This works...
1
by: Tim | last post by:
Hi, I would like to create a custom mouse cursor for my print preview page. I want to use a bitmap of a magnifiying glass with a plus in it. Pretty standard stuff. How do I change the cursor?...
6
by: Peter Oliphant | last post by:
I've now asked how three times in this forum with no answers. So I went to the 'windowsforms' newsgroup, and found this post, also unanswered, with the same problem: "Hello, I've tried to...
0
by: Andy Wynn | last post by:
Hello All, I've got a custom control ( Panel-like, but not inheriting from Panel) that has a header region that's custom drawn. Custom Control is using a custom controldesigner class that...
4
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I...
0
vekipeki
by: vekipeki | last post by:
Does anyone know if there is a way to set a custom mouse cursor for an ActiveX control in .Net? I am adding some mouse functionality to an existing ActiveX control, and would like to change the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.