Creating and Connecting the Controls |
The user control implemented through the BrowserAppControl class is instantiated through Microsoft Internet Explorer. It acts as a container for the four controls of the TX Text Control .NET class library. The next step is to put these four controls in this container and connect them. Switch to the designer mode, click on the BrowserButtonBar icon and draw it on the form. In the same way, create two BrowserRulerBar controls, a BrowserStatusBar and finally a BrowserTextControl. Now click on each of the 5 controls in turn and set their Dock property, so that they fill the form entirely and are properly resized when the program runs. Set the Dock property to Top for the BrowserButtonBar and one BrowserRulerBar, to Left for the second BrowserRulerBar and to Bottom for the BrowserStatusBar. Finally set the Dock property of the BrowserTextControl to Fill. ![]() At program start, the keyboard input focus is set through the framework automatically to the control that has a tab index of zero. To be sure that the BrowserTextControl gets the input focus, set its TabIndex property to zero. Add the following code to the constructor of the BrowserAppControl, so that the five controls work together: [C#]
public BrowserAppControl()
{
InitializeComponent();
browserTextControl1.ButtonBar = browserButtonBar1;
browserTextControl1.RulerBar = browserRulerBar1;
browserTextControl1.VerticalRulerBar = browserRulerBar2;
browserTextControl1.StatusBar = browserStatusBar1;
browserTextControl1.ViewMode = TXTextControl.ViewMode.PageView;
browserTextControl1.CreateControl();
}
[Visual Basic]
Public Sub New()
InitializeComponent()
BrowserTextControl1.ButtonBar = browserButtonBar1
BrowserTextControl1.RulerBar = browserRulerBar1
BrowserTextControl1.VerticalRulerBar = browserRulerBar2
BrowserTextControl1.StatusBar = browserStatusBar1
BrowserTextControl1.ViewMode = TXTextControl.ViewMode.PageView
BrowserTextControl1.CreateControl()
End Sub
After adding this code compile the project. Visual Studio .NET creates the assembly BrowserApplication.dll containing the implementation of the BrowserAppControl control. |