PDA

View Full Version : Custom mouse icon?


PEN
09-01-2009, 08:36 PM
Is there a way to setup custom mouse icons?

ypuech
09-01-2009, 09:13 PM
Yes, I have been able to do that with the .NET Framework.

From MSDN:
The mouse pointer is represented by the Cursor class, and each Control has a System.Windows.Forms.Control.Cursor property that specifies the pointer for that control. The Cursor class contains properties that describe the pointer, such as the Position and HotSpot properties, and methods that can modify the appearance of the pointer, such as the Show, Hide, and DrawStretched methods.

In the Cursor class, there is a static Current property that represents the current used cursor. You can create a custom mouse cursor by using the constructor Cursor(String) or Cursor(Stream).

denisT
09-01-2009, 09:18 PM
Is there a way to setup custom mouse icons?


c = dotnetclass "System.Windows.Forms.Cursor"
c.Current = dotnetobject "System.Windows.Forms.Cursor" "myCursor.ico"


but where and how do you want to show it? you can show this cursor just over dotnet controls

SyncViewS
09-01-2009, 10:08 PM
So it won't work on viewports and standard interface, right? Any solution for that? (SDK apart)

- Enrico

PEN
09-02-2009, 01:50 AM
I'm looking to have it just over the tool that I'm developing. I'll have a look at what you have there. Will it only use ico files?

MarcoBrunetta
09-02-2009, 05:12 AM
Hum from what I remember using .net will change the cursor on any "surface", but as soon as you move the mouse it returns to the "correct" cursor (maybe this only happens if the main thread is not busy however? not sure). On most .net controls you can set the cursor property to whatever cursor you want, which will remain even if you move the mouse, but of course only over that control.

As for the cursors themselves you can use "System.Windows.Forms.Cursors" along with "System.Windows.Forms.Cursor" (notice the S at the end, they are two different classes) to set the current cursor to one of the standard windows cursors. For instance:


cursors = dotNetClass "System.Windows.Forms.Cursors"
cursor = dotNetClass "System.Windows.Forms.Cursor"
cursor.current = cursors.WaitCursor


will set the cursor to the hourglass in XP and to the twirly circle in Vista.

JHN
09-02-2009, 09:27 AM
Maybe this example, can be implemented in max?
http://www.ii.uni.wroc.pl/~wzychla/cs_enFAQ.html
-Johan

PEN
09-02-2009, 12:52 PM
Thanks guys, I will be trying this in the next few days and I will post what I get working.

JHN, I think that can be adapted.

MerlinEl
09-03-2009, 10:55 AM
Hi Paul

try this

cursors = dotNetClass "System.Windows.Forms.Cursors"

hand_move = dotNetObject "System.Windows.Forms.Cursor" "C:\WINDOWS\Cursors\hmove.cur"

cursors.Hand.Current = hand_move

PEN
09-03-2009, 01:10 PM
Thanks.

Here is a just a piece of the insanity that I have been working on.

http://penproductions.ca/temp/composer.jpg

scrimski
09-03-2009, 01:35 PM
Whoa. Custom tool for a client or public?
MaxScript only?

MarcoBrunetta
09-03-2009, 01:36 PM
:eek:

Are you trying to use every control type available? =P

PEN
09-03-2009, 01:57 PM
Ya I have a goal, I want to use every Max script command possible in one tool;)

Yes this is all Max script. The full tool has, so far, five scripted geometry plugins and this main UI. The UI is now using a createDialog with a main rollout and two sub rollouts that you see on the right side. Those sub rollouts display the rollouts from the scripted geometry objects when they are selected in the treeView. For the left side I have a dotNet flowLayOut as the main panel then I'm loading in tool strips, a label, tabControl and then a splitContainer with treeView and ListView. The tree and list are synced up so they act as one. Part of the syncing is happening via data that is stored in a struct and then converted to a dotNetMxsValue and placed in the tag property of each of the treeNodes and listItems.

Sorry, this will not be for the public but I figure I should share the ideas of how I'm building it.

JHN
09-03-2009, 02:08 PM
That's looks pretty intense! It's a tool for blending animation clips I presume!?
It's a lot of work to build all that to have a mousecursor change it's picture ;)

-Johan

PEN
09-03-2009, 02:20 PM
That is the tool, It allows for non-linear animation of mouse cursors. Then I just capture the mouse cursor to an MOV on the fly. Fastest way to create a TV series ever.

:curious:

JHN
09-03-2009, 02:45 PM
Wicked! The world of mouse cursor animations will never be the same again. :thumbsup:

Really like to just see other peoples interfaces, can learn a lot from looking alone! Thanks for sharing!

-Johan

slimeburger
04-01-2010, 03:49 PM
I'm looking for a custom cursor for my tool too.
Nice and easy to change the cursor using that dotnet line.
How the heck does one go about stopping max from resetting the cursor to one of it's choice?
I'm trying to avoid using while loops or callbacks here for my 'pick mode'

AD

PEN
04-01-2010, 04:07 PM
Not sure off hand, I only needed them over the UI I was creating. Are you trying to use them over the Max UI and they are changing back on you?

CGTalk Moderation
04-01-2010, 04:07 PM
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.