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
  03 March 2013
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?

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/
 
  03 March 2013
(
	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.
 
  03 March 2013
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/
 
  03 March 2013
I would love to know what you are doing with this Dave. Sounds interesting.
__________________
Paul Neale
http://paulneale.com
 
  03 March 2013
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.
 
  03 March 2013
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



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 06:56 PM.


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