BotNet Framework

I wanted to script a library of functions to help me set up certain DotNet UI objects without having to type everything out each time i wanted to use them. I obviously could not resist the pun either. One of the methods of setting up a DotNetControl in 3DS Max in order to have a cohesive UI look you need to set multiple properties for each. Please note this is very much a work in progress. If you feel the need to add a function to this please do so, but be sure to let me know so that I can update it!
For example, to setup a button with a see-through background image, you can call the following botnet function -
fn imagebutton btn image style bgcolor mobg mdbg tcolor:undefined =
-- tcolor is transparent color to be passed to the imagelist
(
btn.backcolor = colorpreset bgcolor
btn.flatstyle = style
btn.FlatAppearance.MouseOverBackColor = colorpreset mobg
btn.FlatAppearance.MouseDownBackColor = colorpreset mdbg
if tcolor != undefined then (btn.imagelist = (imagelist image invisible:tcolor)) else (btn.imagelist =(imagelist image))
btn.imageindex = 0
image = nothing
)
The variable tcolor is passed to an imagelist control object and used as the mask color. In dotnet you can pass an image as the button background color, but in order to get a transparent image, you need to pass an imagelist.
Note that the easy way to do this is to use a 32 bit PNG for the button image. Windows will recognise the transparency information and render the button correctly. However, if you only have a 24 bit image, this method is the way, so that you can supply the background color as a matte.
When placed within the on open event of the rollout, the code looks like this. Note i am using an image with a white background in my scripts folder called "addremoveicons.bmp"
rollout DNimagebuttons "BotNet Button Methods()" width:190 height:220
(
dotNetControl btnclose "button" pos:[9,9] width:80 height:45
dotNetControl msgbox "button" pos:[9,70] width:175 height:45
dotNetControl msgbox2 "button" pos:[9,125] width:95 height:85on DNimagebuttons open do
(
BotNet.imagebutton btnclose ((getdir #scripts) + "\\addremoveicons.bmp") flat #maxback #maxactive #crimson tcolor:#white BotNet.imagetextbutton msgbox "A Message Here" 8 ((getdir #scripts) + "\\addremoveicons.bmp") flat #slategray #maxactive #limegreen tcolor:#white fontcolor:#red textalignment:botnet.bnfalign.BottomRight imagealignment:botnet.bnfalign.TopLeft BotNet.imagetextbutton msgbox2 "or Here" 8 ((getdir #scripts) + "\\addremoveicons.bmp") flat #maxback #yellow #limegreen tcolor:#white fontcolor:#purple textalignment:botnet.bnfalign.BottomCenter imagealignment:botnet.bnfalign.TopCenter
)on msgbox click do
(
local msgstring = "Waheeeey, a funky dotnet button"
Botnet.messagebox " LoneRobot.BotNetFramework" msgstring
)
)
createdialog DNimagebuttons style:#(#style_toolwindow, #style_sysmenu)
Depending on which alignment option you provide can yield a variety of different button styles. I have set the button style to flat, i just prefer this but you could change it to system buttons should you prefer.
At the moment it is limited to these UI functions, i hope in the future to add many more

you will need this logo in your scripts directory if you want to use the BotNet MessageBox function. You can obviously replace this with another image but if you want, right click this one and download...
