Dotnet - Dotnet Shape to Mouse Cursor

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 03 March 2013   #1
Dotnet - Dotnet Shape to Mouse Cursor

I want to make a custom shape and then have that as a cursor using dotnet.

How can I convert a dotnet drawing object to a cursor?

Code:
cursors = dotNetClass "System.Windows.Forms.Cursors" --hand_move = dotNetObject "System.Windows.Forms.Cursor" "C:\WINDOWS\Cursors\cross_rm.cur" hand_move = dotNetObject "System.Drawing.Rectangle" 0 50 0 50 cursors.Hand.Current = hand_move
__________________
Maxscript Made Easy...
http://davewortley.wordpress.com/
 
Old 03 March 2013   #2
Code:
( local bmp = dotNetObject "System.Drawing.Bitmap" 50 50 local gfx = (dotnetClass "system.drawing.graphics").fromImage bmp local rect = dotNetObject "System.Drawing.Rectangle" 0 0 50 50 gfx.FillEllipse (dotNetClass "System.Drawing.Brushes").red rect gfx.dispose() local hCursor = dotNetObject "System.IntPtr" (bmp.getHIcon()) (dotnetClass "Cursor").current = dotNetObject "Cursor" hCursor )


Of course, this will only last until you move the mouse as max will send a WM_SETCURSOR message on each mouse move.

If it's for a specific form, use the form.Cursor property instead.

If you need to replace the mouse cursor, you will need to take over the 3dsmax wndproc and override the WM_SETCURSOR messages.
 
Old 03 March 2013   #3
Thanks Lo.

As it's in the MouseDown event handler for a dotnet button it gets called repeatedly which is what I need.
__________________
Maxscript Made Easy...
http://davewortley.wordpress.com/
 
Old 03 March 2013   #4
I would love to know what you are doing with this Dave. Sounds interesting.
__________________
Paul Neale
http://paulneale.com
 
Old 03 March 2013   #5
Quote:
Originally Posted by DaveWortley
Thanks Lo.

As it's in the MouseDown event handler for a dotnet button it gets called repeatedly which is what I need.


In that case you should use the Cursor property of the button or form instead of (dotnetClass "Cursor").current

Also be sure to dispose of your bitmaps properly.
 
Old 03 March 2013   #6
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:50 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.