Example Code

Test of .NET docking libraries using Labview

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

Overview
Inspired by an older discussion, I make a C# library to load some .NET docking libraries. My first test with the free http://dockpanelsuite.com/  failed: Inside of a Labview .Net Control dragging of the windows is not possible. Then I test also the free https://avalondock.codeplex.com/  . It works, but it is a WPF Control, so the performance is not so good.


Description
Inspired by an older discussion, I make a C# library to load some .NET docking libraries. My first test with the free http://dockpanelsuite.com/  failed: Inside of a Labview .Net Control dragging of the windows is not possible. Then I test also the free https://avalondock.codeplex.com/  . It works, but it is a WPF Control, so the performance is not so good.

I included in the test the evaluation docking controls of the following commercial tools:

http://www.divelements.co.uk/net/controls/sanddock/  (Not active anymore)

http://www.actiprosoftware.com/products/controls/windowsforms/docking

http://www.telerik.com/products/winforms/dock.aspx

ActiPro need to install an evaluation license: Download and install the evaluation version from: http://www.actiprosoftware.com/download/evaluations.The trial controls of SandDock and RadDock from Telerik show a nag screen sometimes.

I tested also the docking control of  DevExpress, but tabbed document windows can only used inside a top level Form as MDIContainer. But a top level form can not load in a .NET Labview control. Tool windows are possible.

In the 7z Archive is the VS2010 project with an extra test App.

I used Labview 2015, run Main.vi in folder Labview2105. At first select the class to run. Changing of the class during runtime is not supported.

Then document or tool windows can added:

In the folder Labview2011 I saved the vi in Labview 2011 format. I tested it with LV2012.

The lvdock.dll is a .net 4.0 assembly. For Labview versions up to 2012 see Loading .NET 2.0, 3.0 and 3.5 Assemblies in LabVIEW . I attached the LabVIEW.exe.config to copy in the Labview folder (i.e. c:\Program Files (x86)\National Instruments\LabVIEW 2012\ )

Problems:

General: Sometimes after change of docking mode (float, tabbed) the window redraw does not work. In the resize event a redraw is forced, so resize of the window will help.

SandDock: After unhide a tool windows sometime a null reference exception is thrown.

AvalonDock: is slow, because it is WPF, so the winform hosting controls are used.

SandDock and ActiPro using .NET 2/3.5 framework. In Windows 8/10 it must installed by adding the Windows feature .NET Framework 3.5 (contain .NET 2.0+3.0). Possible it is installed already by a previous Labview installation. A special Labview.exe.config to load .Net 2 assemlies  https://www.ni.com/docs/en-US/bundle/labview/page/running-operations-using-the-command-line-interfac... is not necessary.

If Labview is closed without pressing the Stop Button, then Labview terminated not normal, sometime it exist as process without a window and must close by the Task Manager. Please save other vi before run Main.vi to avoid data loss.

Edit:

Changing in Main.vi the event "Application Instance Close" to "Application Instance Close?" give enough time for calling DockContainer.Dispose after the main loop. Then Labview or the compiled exe can closed by the Window Close Button (x).


Requirements

Software:

  1. LabVIEW 2012(or compatible)

 

Steps to Implement or Execute Code

  1. Download the .zip file
  2. Set your desired configuration (a, x1, x2, degrees, etc)
  3. Run the VI

 

Additional Information or References
VI Block Diagram

1.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.