# Add Rulers, Toolbars, and a Status Bar

> Add a ButtonBar, two RulerBars and a StatusBar to a Windows Forms TextControl with the smart tag or in code, and set ButtonPositions and ShowZoomTrackBar.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for Windows Forms > Getting Started > Document Editor > Add Rulers, Toolbars, and a Status Bar
- **1672 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/rulers-toolbars/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/rulers-toolbars/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/rulers-toolbars/llms-full.txt

---

Not every application needs a ribbon. A classic editor surrounds the `TextControl` with a button bar for font and paragraph formatting, rulers for margins, indents and tabs, and a status bar. The steps below add these controls with the smart tag, connect them in code as an alternative, and choose which buttons and status information they show.

### Prerequisites

- A Windows Forms project with the package `TXTextControl.TextControl.WinForms.SDK` and a `TextControl` on **Form1**, as created in the first three sections of [Create Your First Windows Forms Application](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/first-application/llms-full.txt). Do not add the ribbon: the button bar replaces it.

### Add the Controls With the Smart Tag

1. Open **Form1** in the designer.
2. Click the smart tag in the upper right corner of the `TextControl`.
3. In the **Wizards** group, click **Add a ButtonBar**, **Add a StatusBar**, **Add a Ruler** and **Add a Vertical Ruler**.
4. Click **Arrange Controls Automatically**.

The wizards add a [ButtonBar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/buttonbar/llms-full.txt), a [StatusBar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/statusbar/llms-full.txt) and two [RulerBar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/rulerbar/llms-full.txt) controls to the form. **Arrange Controls Automatically** connects them to the `TextControl` and docks all controls so that they fill the form.

In the designer, the form now shows the button bar and the horizontal ruler at the top, the vertical ruler at the left and the status bar at the bottom:

![Form1 in the designer with a button bar for font and paragraph formatting, a horizontal and a vertical ruler, the page of textControl1 and a status bar with a zoom slider.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-winforms/designer-bars-rulers.f80b7136.webp)

Press **F5**. The form shows the editor with the button bar, the two rulers and the status bar around it. Select some text and click a button of the button bar to format it: the button bar shows and sets the font and paragraph attributes of the text.

### Add the Controls From the Toolbox

You can also drag **ButtonBar**, **RulerBar** and **StatusBar** from the toolbox tab **TX Text Control 34.0** onto the form. **Arrange Controls Automatically** in the smart tag of the `TextControl` then finds the controls on the form, arranges them around the editor and adds the code that connects them.

A ruler docked at the top or bottom of the form is horizontal, and a ruler docked at the left or right is vertical: [RulerBar.Alignment](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/rulerbar/alignment-property/llms-full.txt) follows the docking.

### Connect the Controls in Code

The connection is a set of properties of the `TextControl`, which you can also set in code, for example in the constructor of the form. Use the names the controls have on your form, shown in the **Properties** window:

```csharp
public Form1()
{
    InitializeComponent();

    // Connect the bars to the editor
    textControl1.ButtonBar = buttonBar1;
    textControl1.RulerBar = rulerBar1;
    textControl1.VerticalRulerBar = rulerBar2;
    textControl1.StatusBar = statusBar1;
}
```

[ButtonBar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/buttonbar-property/llms-full.txt), [RulerBar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/rulerbar-property/llms-full.txt), [VerticalRulerBar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/verticalrulerbar-property/llms-full.txt) and [StatusBar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/statusbar-property/llms-full.txt) each connect one bar. A property that is not set is `null`, and the editor works without that bar.

### Choose the Buttons and the Status Information

The button bar and the status bar show a default set of items, which properties change. The following lines, added to the constructor after the connections, reduce the button bar to two buttons and add a zoom slider and the key states to the status bar:

```csharp
// Set all 31 positions so that unused positions contain Button.None
TXTextControl.Button[] buttons = new TXTextControl.Button[31];
buttons[0] = TXTextControl.Button.FontBoldButton;
buttons[1] = TXTextControl.Button.FontItalicButton;
buttonBar1.ButtonPositions = buttons;

// Draw a separator before the italic button, with none before the bold button
bool[] separators = new bool[31];
separators[1] = true;
buttonBar1.ButtonSeparators = separators;

// Show a zoom slider and the state of CAPS LOCK, NUM LOCK and insert mode
statusBar1.ShowZoomTrackBar = true;
statusBar1.ShowKeyStates = true;
```

The code works as follows:

- [ButtonPositions](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/buttonbar/buttonpositions-property/llms-full.txt) has 31 positions. Assigning a shorter array leaves later positions unchanged. The new array sets the first two positions to bold and italic and leaves the other positions at `Button.None`, so the default buttons are removed. [ResetButtonPositions](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/buttonbar/resetbuttonpositions-method/llms-full.txt) restores the default set.
- [ButtonSeparators](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/buttonbar/buttonseparators-property/llms-full.txt) controls the separator before each position. Index 1 draws the separator before the second button. The other entries of the new 31-element array are `false`, so no leading or default separators remain.
- [ShowZoomTrackBar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/statusbar/showzoomtrackbar-property/llms-full.txt) shows a track bar that displays and sets the zoom, and [ShowKeyStates](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/statusbar/showkeystates-property/llms-full.txt) shows the state of CAPS LOCK, NUM LOCK and insert or overwrite mode.

[Toolbars and Mini Toolbars](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/toolbars/llms-full.txt) describes more properties of the button bar, and [Rulers and Status Bar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/rulers-status-bar/llms-full.txt) those of the rulers and the status bar, such as the scale unit of the rulers and the other areas of the status bar.

### Next Steps

- [Load and Save Documents](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/load-save/llms-full.txt): add buttons that open and save documents.
- [Create a Ribbon Application with Sidebar Support](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/ribbon-sidebar/llms-full.txt): build the editor with a ribbon and sidebars instead.
- [Rulers and Status Bar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/rulers-status-bar/llms-full.txt): the rulers and the status bar in detail.

---

## Nearby

- **Previous:** [Create a .NET Framework Application](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/dotnet-framework/llms-full.txt)
- **Next:** [Create a Ribbon Application With Sidebar Support](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/ribbon-sidebar/llms-full.txt)
