How do I resize a dockbar in Rhino 8

Hi,
I am building a Rhino plugin in CSharp/Dot net.
This plugin creates dockbars similarly to SampleCsDockBar project.
I need my dockbar to be docked to the right, with a specific width.
How can I achieve that?
I am not happy with the solutions to Resize docked panel from code and Automatic Resize Behavior for DockBar in WPF Plugin
I was able to get it docked to the right easily:

      DockBarCreateOptions create_optionsR = new DockBarCreateOptions
      {
        DockLocation = DockBarDockLocation.Right,
        Visible = true,
        DockStyle = DockBarDockStyle.Any,
        FloatPoint = new System.Drawing.Point(100, 100)
      };
      MyDockBar.Create(create_optionsR);

But I cannot set the width. Things I’ve tried after the creating of the DockBar:

MyDockBar.Dock(DockBarDockLocation.Right, new System.Drawing.Rectangle(0, 0, 400, 600));
((WpfHost)MyDockBar.WinFormsContent).ClientSize = new System.Drawing.Size(400, 600);
((WpfHost)MyDockBar.WinFormsContent).Bounds = new System.Drawing.Rectangle(0, 0, 400, 600);
((WpfHost)MyDockBar.WinFormsContent).Width = 500;

Things I’ve tried before the creation of the DockBar:

    public MyDockBar() : base(MyPlugIn.Instance, BarId, "Stage selection")
    {
      WpfHost host = new WpfHost(new MyPluginView(), null);
      host.MinimumSize = new System.Drawing.Size(400, 100);
      SetContentControl(host);
    }

Is there a way to change the width?
I am also open to simulating mouse click-drag-release if that’s the only solution.
This plugin is intended to be used in-house by several users. I am also open to updating user settings/configuration if I can save the dockbar position and size.

SystemInfo:

Rhino 8 SR19 2025-5-12 (Rhino 8, 8.19.25132.01001, Git hash:master @ 57e3eb280b0f32cbe59f53a554be5e8ffa66fc36)
License type: Commercial, build 2025-05-12
License details: Stand-Alone

Windows 10 (10.0.19045 SR0.0) or greater (Physical RAM: 12GB)
.NET 7.0.20

Computer platform: LAPTOP  - Plugged in [48% battery remaining]

Hybrid graphics configuration.
  Primary display: Intel(R) UHD Graphics (Intel) Memory: 1GB, Driver date: 5-19-2020 (M-D-Y).
    > Integrated graphics device with 3 adapter port(s)
        - Windows Main Display is laptop's integrated screen or built-in port
  Primary OpenGL: NVIDIA GeForce GTX 1650 (NVidia) Memory: 4GB, Driver date: 7-5-2020 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 451.67
    > Integrated accelerated graphics device with 1 adapter port(s)
        - Video pass-through to primary display device

OpenGL Settings
  Safe mode: Off
  Use accelerated hardware modes: On
  GPU Tessellation is: On
  Redraw scene when viewports are exposed: On
  Graphics level being used: OpenGL 4.6 (primary GPU's maximum)
  
  Anti-alias mode: 4x
  Mip Map Filtering: Linear
  Anisotropic Filtering Mode: High
  
  Vendor Name: NVIDIA Corporation
  Render version: 4.6
  Shading Language: 4.60 NVIDIA
  Driver Date: 7-5-2020
  Driver Version: 27.21.14.5167
  Maximum Texture size: 32768 x 32768
  Z-Buffer depth: 24 bits
  Maximum Viewport size: 32768 x 32768
  Total Video Memory: 4 GB

Rhino plugins that do not ship with Rhino
  C:\guillaume\bracedesigner\build\Debug\net7.0-windows\OsskinRhinoPlugin.rhp	"OsskinRhinoPlugin"	1.0.0.0

Rhino plugins that ship with Rhino
  C:\Program Files\Rhino 8\Plug-ins\Commands.rhp	"Commands"	8.19.25132.1001
  C:\Program Files\Rhino 8\Plug-ins\rdk.rhp	"Renderer Development Kit"	
  C:\Program Files\Rhino 8\Plug-ins\RhinoRenderCycles.rhp	"Rhino Render"	8.19.25132.1001
  C:\Program Files\Rhino 8\Plug-ins\rdk_etoui.rhp	"RDK_EtoUI"	8.19.25132.1001
  C:\Program Files\Rhino 8\Plug-ins\NamedSnapshots.rhp	"Snapshots"	
  C:\Program Files\Rhino 8\Plug-ins\MeshCommands.rhp	"MeshCommands"	8.19.25132.1001
  C:\Program Files\Rhino 8\Plug-ins\RhinoCycles.rhp	"RhinoCycles"	8.19.25132.1001
  C:\Program Files\Rhino 8\Plug-ins\import_STL.rhp	"STL Import"	
  C:\Program Files\Rhino 8\Plug-ins\Toolbars\Toolbars.rhp	"Toolbars"	8.19.25132.1001
  C:\Program Files\Rhino 8\Plug-ins\3dxrhino.rhp	"3Dconnexion 3D Mouse"	
  C:\Program Files\Rhino 8\Plug-ins\Displacement.rhp	"Displacement"	
  C:\Program Files\Rhino 8\Plug-ins\SectionTools.rhp	"SectionTools"	


You could try using WindowLayouts as this is just internal.

Thanks Callum Sykes and sorry for the late reply. Actually, the plugin seems to remember its panel configuration when the user exits Rhino cleanly (which I was not doing in debug), so this is not really an issue anymore (the user just adjusts the first time they use our plugin).

1 Like