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

static Cursor

P: n/a
I load my custom cursor with the constructor call

System.Windows.Forms.Cursor mycursor=new
System.Windows.Forms(GetType(),"MyCursor.Cur");

and the appropriate command line

csc -target:winexe -res:MyCursor.Cur,MyNamespace.MyCursor.Cur *.cs

This works well. But if I want to have a static cursor, I cannot use
GetType(). Fortunately there is another constructor that does without
GetType():

System.Windows.Forms.Cursor mycursor=new
System.Windows.Forms("MyCursor.Cur");

and the same command line. This also works well. But the problem is, in the
latter case, when I move the application out of original directory, the app
crashes. In the former case the resource is correctly linked in and I can
run the program from any directory.

How can I embed a static cursor in my application and run it from anywhere?

(The program size reveals that in the latter case the cursor IS embedded in
the app, but is not used, apperently)
Nov 6 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Martijn Mulder <i@mwrote:
I load my custom cursor with the constructor call

System.Windows.Forms.Cursor mycursor=new
System.Windows.Forms(GetType(),"MyCursor.Cur");

and the appropriate command line

csc -target:winexe -res:MyCursor.Cur,MyNamespace.MyCursor.Cur *.cs

This works well. But if I want to have a static cursor, I cannot use
GetType(). Fortunately there is another constructor that does without
GetType():

System.Windows.Forms.Cursor mycursor=new
System.Windows.Forms("MyCursor.Cur");

and the same command line. This also works well. But the problem is, in the
latter case, when I move the application out of original directory, the app
crashes. In the former case the resource is correctly linked in and I can
run the program from any directory.

How can I embed a static cursor in my application and run it from anywhere?

(The program size reveals that in the latter case the cursor IS embedded in
the app, but is not used, apperently)
Use typeof(...) to get a Type reference.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.