As you may already know, we provide templates to develop PI ProcessBook 3.x .NET Add-Ins (they were explained in this webinar and are available on the vCampus Download Center). This post is related to one of those 4 templates: the Docking Window Add-In.
In the Visual Studio 2005 version of this template, a PBControlView object named ctrlView is added to the docking window (m_dockWindow variable in the Connect class). On this view, a label is then created:
----> Yes, you are right: this is a COM control, not a .NET one!
----> And yes, you are right again: we are not using the Form/UserControl designer provided in Visual Studio, which most people are using on a regular basis.
The good news is: there is a way for you to easily design a .NET UserControl with the Visual Studio designer and then have the docking window load it. Here's how you can do this in 5 simple steps:
2. Double-click on the User Control in the Solution Explorer - you'll get in design mode.
3. Resize the User Control, add the controls (and the code) you want
(Hint: if you have a control which you want to occupy the whole docking window (e.g. TreeView), you can "dock it in the parent container" as shown in the screenshot below. That way you don't have to write code to handle resizing of the docking window by the user in ProcessBook )
4. Jump in the code for your User Control and make it visible to COM
(Remember: PI ProcessBook is COM-based... which means that under the hood, the PBControlView.CreateControl method - which we'll use in the next step) expects to create COM controls)
5. Back to the code in the OnConnection method of the Connect class, get the PBControlView to load that ".NET-but-COM-visible control"
(and keep a reference to it for future usage:
Dim usrCtrl As UserControl1 = DirectCast( _
UserControl1 usrCtrl =
Hope this helps!