CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 03-04-2013, 07:08 PM   #1
DaveWortley
<database error>
 
DaveWortley's Avatar
portfolio
David Wortley
Technical Director
London, United Kingdom
 
Join Date: Dec 2004
Posts: 1,878
Send a message via MSN to DaveWortley
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-04-2013, 09:19 PM   #2
lo
the frequentest!
portfolio
Rotem Shiffman
Tel Aviv, Israel
 
Join Date: Jul 2005
Posts: 2,839
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-05-2013, 12:08 PM   #3
DaveWortley
<database error>
 
DaveWortley's Avatar
portfolio
David Wortley
Technical Director
London, United Kingdom
 
Join Date: Dec 2004
Posts: 1,878
Send a message via MSN to DaveWortley
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-05-2013, 03:49 PM   #4
PEN
R&D/Technical Director
 
PEN's Avatar
portfolio
Paul Neale
PEN Productions
Canada
 
Join Date: Jun 2002
Posts: 7,416
I would love to know what you are doing with this Dave. Sounds interesting.
__________________
Paul Neale
http://paulneale.com
 
Old 03-05-2013, 03:53 PM   #5
lo
the frequentest!
portfolio
Rotem Shiffman
Tel Aviv, Israel
 
Join Date: Jul 2005
Posts: 2,839
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-05-2013, 03:53 PM   #6
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:52 PM.


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