Creating Multiple Actions Pane Controls

To have a dynamic actions pane, you must create multiple controls that you can add and remove according to the user's context in the document. In this section you will create two controls. You can use the default control names for all of the Windows Forms controls that you add to the actions pane controls.

1. Add two actions panes controls to your Word solution, keeping the default names (ActionsPaneControll and ActionsPaneControl2).

2. Add three Label controls to ActionsPaneControll, and set their Text properties to Author, Addressee, and Re, respectively.

3. Add a Button control to ActionsPaneControll, and change its Text property to Insert.

4. Add a ComboBox control and two TextBox controls to ActionsPaneControll, as shown in Figure 5.12.

5. Add three Label controls to ActionsPaneControl2, and set their Text properties to Salutation, Body, and Closing, respectively.

6. Add a Button control to ActionsPaneControl2, and change its Text property to Insert.

7. Add two ComboBox controls and two TextBox controls, as shown in Figure 5.12.

Notice that both controls contain an Insert button. Normally, you would display only one button to insert the text of all the controls that appear on the task pane. In this case, you're showing only one control at a

Figure 5.12. Two actions pane controls

time, so you need to ensure that there's a way to insert the data from the controls into the document, even if only one of the actions pane controls is visible. You could also create a separate actions pane control that contains the Insert button and handles the insertion of the text from both ActionsPaneControl1 and ActionsPaneControl2, but to keep this example simple, we use two separate Insert buttons.

0 0

Post a comment