Notifications
Clear all

[Closed] dot net rollover

I want to create a dot net window rollover, as in html, so that certain sections of a graphic are highlighted on mouse rollover, then clickable to trigger an action…any simple code for this to start me off? Thanx again guys.

12 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

a .NET solution can be the using of GraphicsPath and control’s region… here is a sample:

try(form.close()) catch()	
 form = dotnetobject "MaxCustomControls.Maxform"
 form.Text = "Shape Control by denisT"	
 form.StartPosition = form.StartPosition.Manual
 form.Bounds = dotnetobject "System.Drawing.Rectangle" 800 200 300 200 
 
 bt0 = dotnetobject "Button"
 bt0.name = "Green Star"
 bt0.FlatStyle = bt0.FlatStyle.Flat
 bt0.BackColor = bt0.BackColor.Green
 bt0.FlatAppearance.MouseOverBackColor = bt0.FlatAppearance.MouseOverBackColor.LightGreen
 bt0.Bounds = dotnetobject "System.Drawing.Rectangle" 0 0 100 100
 
 bt1 = dotnetobject "Button"
 bt1.name = "Red Star"
 bt1.FlatStyle = bt1.FlatStyle.Flat
 bt1.BackColor = bt1.BackColor.Red
 bt1.FlatAppearance.MouseOverBackColor = bt1.FlatAppearance.MouseOverBackColor.Pink
 bt1.Bounds = dotnetobject "System.Drawing.Rectangle" 50 50 100 100
 
 pp0 = 
 #(
 	dotnetobject "System.Drawing.PointF" 68 57,
 	dotnetobject "System.Drawing.PointF" 92 36,
 	dotnetobject "System.Drawing.PointF" 60 33,
 	dotnetobject "System.Drawing.PointF" 47 3,
 	dotnetobject "System.Drawing.PointF" 35 33,
 	dotnetobject "System.Drawing.PointF" 3 36,
 	dotnetobject "System.Drawing.PointF" 27 57,
 	dotnetobject "System.Drawing.PointF" 20 88,
 	dotnetobject "System.Drawing.PointF" 47 72,
 	dotnetobject "System.Drawing.PointF" 75 88
 )
 pp1 = 
 #(
 	dotnetobject "System.Drawing.PointF" 45 61,
 	dotnetobject "System.Drawing.PointF" 68 61,
 	dotnetobject "System.Drawing.PointF" 48 50,
 	dotnetobject "System.Drawing.PointF" 60 30,
 	dotnetobject "System.Drawing.PointF" 40 42,
 	dotnetobject "System.Drawing.PointF" 29 22,
 	dotnetobject "System.Drawing.PointF" 29 45,
 	dotnetobject "System.Drawing.PointF" 6 44,
 	dotnetobject "System.Drawing.PointF" 26 56,
 	dotnetobject "System.Drawing.PointF" 14 75,
 	dotnetobject "System.Drawing.PointF" 34 64,
 	dotnetobject "System.Drawing.PointF" 45 84
 )
 
 pt0 = for k=1 to pp0.count collect (dotnetclass "System.Drawing.Drawing2D.PathPointType").Line.value__
 pt1 = for k=1 to pp1.count collect (dotnetclass "System.Drawing.Drawing2D.PathPointType").Line.value__
 
 gp0 = dotnetobject "System.Drawing.Drawing2D.GraphicsPath" pp0 pt0
 gp0.AddEllipse 34 38 25 25
 bt0.region = dotnetobject "System.Drawing.Region" gp0
 gp1 = dotnetobject "System.Drawing.Drawing2D.GraphicsPath" pp1 pt1
 bt1.region = dotnetobject "System.Drawing.Region" gp1
 
 form.Controls.AddRange #(bt0, bt1)
 
 fn onClick s e = print s.name
 dotnet.addeventhandler bt0 "Click" onClick
 dotnet.addeventhandler bt1 "Click" onClick
 
 form.ShowModeless()
   

see the documentation (methods and constructors) of System.Drawing.Drawing2D.GraphicsPath for more information.

post a picture of what you want to get.

Ok, See below. The first is the dot net window with background graphic. The next three are the rollover animation, perhaps a gif animation? When clicking on the associated region, an event is triggered, such as bone creation. Thanks for your time.

 JHN

It will be a lot of work, either with maxscript or c#

Here’s a snippet of what I did for making a “click map”, using any html tool for generating the click maps, an image and mxs to make it work. Ymmv

http://public.subd.nl/cgtalk/JHN_clickMap_framework_01.zip

It reads the clickmaps from the html file, then build an array with coords form it, and filters it on the imgtag when you click on it. At some point I had written a get/set pixels function to also allow mouse over effects, but can’t find the code anymore. This was written pre .net era, also look up LoneRobot’s site and get some .net inspiration.

Not sure I would use it again now, but it works.

-Johan

Thanks. I will try it out. Still like to hear from dot net specialists tho…

 JHN

Also have a look at Pete’s work here.

~Johan

yes. Interesting, but where and how to get rig studio?

Ok, so forget about the gif animation and rollovers if that’s too difficult…what if I just want a dot net solution to just clicking on ceratain areas to trigger different events?

Interesting. Thanks a lot denis. So I suppose you could have a button on top of a form with it’s own background graphic which you could make visible on mouse over, so it creates in effect rollover image.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

all what you tell above, on .NET forms language calls Regions…

Hmm . I tried to create an event handler function that changed the background image on the button on mouse over but it wouldn’t do it for some reason. I also tried to make it visible on mouse over but it wouldn’t do that either.

Page 1 / 2