Notifications
Clear all

[Closed] Toolbar style buttons

Hi,

I’ve been trying to get (image-)buttons on a rollout to look like the buttons on the max toolbars. So a flat style when the mouse is not rolled over them, a border when it is.
So far I’ve failed to find anything that comes near to this, with either maxscript or .NET.

Any ideas?

3 Replies

Hi Pier,
the feature you’re looking for is new in Max 2009. It’s a property of some User-Interface Controls like Buttons.

border:
NEW in 3ds Max 2009: When set to true or not specified, the button will be drawn with a border. This was the default behavior prior to 3ds Max 2009.

When set to false, the button will be drawn without a border, making it one with the UI background. If the button is enabled, the border will appear when the button is pressed, or upon mouseover.

I’ve found it in the MaxScript Reference, but never tried. Don’t know if it actually works, or if there’s something in .net that can be used in previous Max versions too. Anyway I hope this helps.

  • Enrico

Hey thanks for the tip! I’m currently mainly developing for max9, but I may just slip this one in so the people using 2009 will get nicer buttons.
It doesn’t result in any errors in 9 anyway

hi pjanssen, you have probably found this out already but in case you havent and just for anyone else, dotnet buttons have a style property for if you decided not to use the new border option.

  
rollout dnb "" width:323 height:114
  (
      dotNetControl btn1 "button" pos:[4,5] width:152 height:105
      dotNetControl btn2 "button" pos:[164,5] width:152 height:105    
      
  on dnb open do
  	(
  		btn1.flatstyle = (dotnetclass "System.Windows.Forms.Flatstyle").flat
  		btn1.Text = "A Flat DotNet Button!!"	
  		btn1.TextAlign = (dotnetclass "system.drawing.contentalignment").bottomcenter
  		btn1.flatappearance.MouseoverBackColor = (dotnetclass"System.Drawing.color").yellow
  		btn1.flatappearance.MousedownBackColor = (dotnetclass"System.Drawing.color").limegreen
  		
  		btn2.flatstyle = (dotnetclass "System.Windows.Forms.Flatstyle").popup
  		btn2.Text = "A Popup DotNet Button!!"	
  		btn2.TextAlign = (dotnetclass "system.drawing.contentalignment").topcenter		
  	)
  )
  createdialog dnb

the flat style can be useful because the mouseover color stuff doesnt need to be done in the mouse eventhandlers, it is automatically specified via the property.

however, it is has a line around the button. Another way would be to use a label control and overide the paint handler an draw the raised line via GDI+, that way you could match the max UI via dotnet me thinks. you are losing the ‘clicked’ handler for that though and would have to use the mouse events to register clicks.

FWIW, rollout floaters can also be borderless now in 2009, meaning you can lose the rollout groupbox encircling the controls too.