I’ve been trying to figure out if/how I can host an Eto control on a DockBar in Rhino. I’m using RhinoCommon. The DockBar has a SetCentralControl method with expects a WindowsForms control.
I’ve seen references in some Eto documentation about a .ToNative method which seems like it would likely do the trick. I can’t find this method with the Eto version that ships with Rhino though. There is a method named AttachNative, but it takes no arguments and returns nothing, so I’m not really sure what it’d doing. The docs weren’t really helpful there.
You can find a code sample here:
Please share an example of how to do this. I am also looking for solutions.
In ETO the object you want is called a Panel rather than a DockBar. Given that information (which was not obvious to me), you can look at the samples that Dale references above. So here is the command: rhino-developer-samples/SampleCsEtoPanelCommand.cs at 7 · mcneel/rhino-developer-samples · GitHub
There are a few other files you need in the project:
Hi. Dale. I’m sorry if I’m asking you a dumb question, but is there any way to put Rhino.Eto. in the DockBar? or is there any way to transform the Panel to fit anywhere on the Rhino window ?
If you are talking about the old MFC-style dockbars, not the tabbed panels, then yes.
It can be a bit of work, and there isn’t any documentation for doing this.
The SDK samples contains code that shows how to create these and host a WinForms or WPF window.
To use Eto, you’ll need to call
Dockbar.SetContentControl and pass it an
IWin32Window window. You can get one from an Eto window by calling the
Forms.WindowsInterop.ObjectAsIWin32Window method found in
Obviously, this is a Windows-only deal and does not run in Mac Rhino.
Also, Rhino 8’s tabbed panels can be dock top and bottom, not just left and right. Something to consider.
Is it possible to start (Show) the Panel. in Rhino 7-6 from the bottom. or in another location?
Hi @dale ,
Using the example you have given I have managed to migrate my existing WPF panel to a DockBar so I can set its dock location on launch/install.
RhinoWindows.Controls.DockBar.Show always returns true. However, I have found the docking to be inconsistent. The majority of the time the dock bar is floating and only on some occasions will it be docked to where I set it in the
Any pointers to what could be going wrong?