Notifications
Clear all

[Closed] assembly:how to make a dotNetControl?

I manage to make a custom control compiled in an assembly.
Using it as dotNetObject in a form works fine,
but how can i use it as a dotNetControl?
I did some search on the forum but can’t figure out what i missed.
Any ideas?

6 Replies
dotnet.loadAssembly "your_control_assembly.dll"
rollout test "test" (
  dotnetcontrol ctrl "your_namespace.your_controlclass"
)

Should do the trick.

I had a control who have 2 arguments in his constructor

 DotNetControl "assemblyNameSpace.className" arg1 arg2

throw me an error.
Anyway i found a solution using “System.Windows.Forms.Panel” in a maxscript rollout
Like this
http://www.gamasutra.com/view/feature/3780/integrating_maxscript_and_net_.php?print=1
thanks

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

what is the problem to make your own custom control with 0 arguments constructor? usually UI controls shouldn’t have arguments to be constructed, they have to use default parameters.

Ah so the problem is creating a control which does not have a constructor taking 0 arguments?

yeah exactly!
i found a solution but if you can confirm
I have to tell maxscript the args names, like optional arguments

 DotNetControl test "assembly.control" path:curPath name:"blabla"

My control is a custom bitmap UI.
A PictureBox with 2 Bitmap
one for UI and another one for picking alpha (different alpha does different actions)
(didn’t manage to load anything but bmp for the moment)
I load the 2 bitmap when instancing
There was no particular reason to do it in the constructor.
I will had a default initialization and separate loading
thanks Denis for the “anti-lazy suggestion”