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

Cursors

I am looking for a tutorial for creating and using custom cursors in a .NET
application
Nov 4 '06 #1
2 1818
Hello Martijn,

Cursor class has the number of overloaded constructors, one of which takes
the IntPtr, where you can specify the handle of your custom bitmap image
returned from Bitmap.GetHicon

MMI am looking for a tutorial for creating and using custom cursors in
MMa .NET application
MM>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Nov 4 '06 #2
Hi Martjin,

Here is a short tutorial on how to create and utilize a custom Cursor from
within VS 2005:

1. In VS 2005 (and earlier versions of VS.NET as well, AFAIK) you can create a
cursor by adding a new file to a project and selecting Cursor as the file
type. Create one now and name it, "MyFirstCursor.cur". There is a hot-spot
tool that you can use when designing your cursor. The hot-spot tool button
contains an icon of a solid black arrow pointing to what appears to be a
spark. Use the tool to set the pixel that will be the actual coordinates used
for mouse events.

2. Add a resource file to the project and name it "MyCursors.resx".

3. With the "MyCursors.resx" file open in the designer, select from the
drop-down the view type named, "Files". (The default will probably be
"Strings").

4. Open the Solution Explorer and drag the "MyFirstCursor.cur" file into the
white-space of the "MyCursors.resx" designer.

The .resx file will be compiled into the project's assembly as an embedded
resource. The embedded resource will contain the contents of the
"MyFirstCursor.cur" file. The "MyFirstCursor.cur" file itself is only project
content and will not be contained in the assembly.

5. Use the following code to create a Cursor object for your custom cursor,
"MyFirstCursor.cur":

Cursor cursor;

using (System.IO.MemoryStream stream =
new System.IO.MemoryStream(MyCursors.MyFirstCursor))
{
cursor = new Cursor(stream);
}

6. Set the Form's Cursor:

form.Cursor = cursor;

--
Dave Sexton

"Martijn Mulder" <i@mwrote in message
news:45***********************@news.wanadoo.nl...
>I am looking for a tutorial for creating and using custom cursors in a .NET
application

Nov 4 '06 #3

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

Similar topics

11
by: Alban Hertroys | last post by:
Oh no! It's me and transactions again :) I'm not really sure whether this is a limitation of psycopg or postgresql. When I use multiple cursors in a transaction, the records inserted at the...
22
by: T.S.Negi | last post by:
Hi All, I want to avoid using cursors and loops in stored procedures. Please suggest alternate solutions with example (if possible). Any suggestion in these regards will be appreciated. ...
5
by: Todd Huish | last post by:
I have noticed something disturbing when retrieving datasets over a relatively slow line (multiple T1). I am looking at about 25 seconds to retrieve 500 rows via a php-odbc link. This same select...
6
by: a | last post by:
Hello, I am doing some multithreading in an MDI app, and I can't seem to get the cursor to stay as an Hourglass. I call: Cursor.Current = cursors.wait at the beginning of my routing, and...
10
by: Just Me | last post by:
Does Me.Cursor.Current=Cursors.WaitCursor set the current property of Me.Cursor to Cursors.WaitCursor And Me.Cursor.Current=Cursors.Default set the Me.Current property to something (default)...
5
by: Boni | last post by:
Dear all, 1.Is there a standard set of cursors in windows which can be used? If yes, where. I need a "hand"- cursor for drag-drop operation. 2. What is a best practice to place cursors? In app...
7
by: H. Williams | last post by:
I know the .Net Cursor class doesn't work with color cursors. So I'm currently using the LoadCursorFromFile API with reflection to set color cursors: here is my code: public static extern...
17
by: vishal | last post by:
I am new to sql and require some help on cursors? what are they and how and why are they used for??? it will be kind enough if anyone helps me in this regards.. regards vishal jain.
3
by: schwartzenberg | last post by:
Dear friends, I have just run into a strange DB2 problem. Something i'd some of you would answer, if only shortly. My basic question is: How do i ensure 'insensitive' (ie static) cursors...
1
by: Dima Kuchin | last post by:
Hello, I was trying to find the information about when and where should I use cursors in DB2, no luck. Maybe you can point me to some article that describes just that (or tell me which page is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.