Rhino C# Development (I) : Get Visual Studio Wizard ready
Rhino C# Development (II) : HelloRhino
Now that we are able to talk with Rhino, let’s add our own UI to Rhino. In Rhino 5 with RhinoCommon SDK and Rhino_DotNet, you can easily add .net Winform User Control to Rhino.
1. Add a reference “Rhino_DotNet.dll” to your project, this assembly is located at the same folder where Rhino.exe resides:
Note: after adding this reference, you should change the Copy Local property to false in the Property window of Visual Studio, otherwise, rhino will complain when you install the plugin.
2. In the project, add a Winform user control to the project, drag any controls from Visual Studio Toolboxes, for instance, I added a tool stripe, a label, a progress bar, a button and a group box with a few radio buttons, mine looks like below:
3. Open the plugin class, add a variable and type below code in the constructor, as shown inside the red rectangles below:
Here, we add a MRhinoUiDockBar instance (that is why we need reference Rhino_DotNet.dll) in the constructor. Note that you can generate a GUID by clicking “Tools > Create GUID” menu, and then click the copy button, as shown below.
4. Add an override function OnLoad to notify Rhino to load our custom designed UI on startup:
Now press “Ctrl + F5” in Visual Studio to fire Rhino 5, and install this plugin, you will see our .Net UI is loaded to Rhino, and your can even dock it here and there, since in the above code, we used MRhinoUiDockBar.DockStyle.any in the enumeration parameters.
![]() |
Download Visual Studio 2010 Source project: RhinoAddUI.zip; or RhinoAddUI.7z. |
See also:
Rhino C# Development (I) : Get Visual Studio Wizard ready
Rhino C# Development (II) : HelloRhino
Filed under: CAD, Dotnet/C#, Programming Tagged: .net user control, customization, example, Rhino, Rhino.net, tutorial, UI, Winform
