473,386 Members | 1,786 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,386 software developers and data experts.

Custom Cursors on Custom Controls

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

Nov 16 '05 #1
2 2404
No-one have any ideas on this ?
Still haven't found a solution :(

"Brad" wrote:
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

Nov 16 '05 #2
\\\
Private myCursor as Cursor = New Cursor(Me.GetType, "myCursor.cur")
///
assign the cursor:
\\\
Cursor = myCursor
///
reset the cursor:
\\\
Cursor = Nothing
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Brad" <Br**@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com...
No-one have any ideas on this ?
Still haven't found a solution :(

"Brad" wrote:
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

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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: ...
0
by: Steve Rosenberry | last post by:
The following is a simplifed version of OnGiveFeedback() for my drag source control: protected override void OnGiveFeedback( GiveFeedbackEventArgs e ) { e.UseDefaultCursors = false; if(...
5
by: Just Me | last post by:
I have a UserControl that contains a few controls on it. If when one of the buttons is clicked I want to, in the click event, set the cursor to Cursor = Cursors.WaitCursor I want the cursor...
10
by: everett | last post by:
I am dynamically creating labels. I would like to be able to attach custom properties(?) to the labels so that I can query the property for the data in it later. Is this possible, and how do I...
4
by: Robert | last post by:
I've created a custom control that inherits System.Windows.Forms.UserControl. It consists of three labels next to each other. I am able to access the control's properties and methods, but none...
1
by: Robert | last post by:
This is the code for the custom control: Public Class SPCLabel Inherits System.Windows.Forms.UserControl #Region " Windows Form Designer generated code " Public Sub New() MyBase.New()
6
by: Lars | last post by:
Hi, I have created a simple custom PrintPreviewDialog consisting of a simple standard PrintPreviewControl (.NET 1.1) on a WindowsForm with a few buttons (for printing, zooming, etc.). It is...
5
by: Paul Cheetham | last post by:
Hi, I have some custom colour cursors which I have added to my c# project, and set them to be compiled as "Embedded Resource" It seems impossible to load a colour cursor using the standard...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.