Designing Actions Pane Solutions

You cannot drag and drop controls directly on the actions pane because it does not have a design surface. However, you can use a custom user control as your design surface. You can use a user control, or you can use a type of user control provided by VSTo called the actions pane control. This control is identical to a user control; it was made available in the Add New Item dialog box so that developers can discover it more easily.

You can add the actions pane control to your project and then drag and drop all your desired Windows Forms controls to the actions pane control in the same way you drag controls to a UserForm in a VBA project. After you have designed the actions pane control to your liking, you can programmatically add it to the actions pane.

❖ Note In Word, you access the ActionsPane through the ThisDocument class. In Excel, you access it through the ThisWorkbook class. There is only one actions pane available for the entire workbook.

To add the actions pane control to your solution, right-click the solution in Solution Explorer, point to Add, and click New Item. In the Add New Item dialog box, select Actions Pane Control, and then click Add (see Figure 5.3).

After the actions pane control has been added to your solution, you can drag Windows Forms controls to the actions pane control. Figure 5.4 shows an actions pane control that contains two Label controls.

Figure 5.3. Adding an actions pane control to your solution
Figure 5.4. Designing an actions pane control
0 0

Post a comment