# Built-In Dialog Boxes

> Open the font, paragraph, tabs, page setup and table dialog boxes of the Windows Forms TextControl on a chosen tab, check DialogResult and adapt BookmarkDialog.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for Windows Forms > Document Editor > Ribbon and UI > Built-In Dialog Boxes
- **5002 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/dialog-boxes/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/dialog-boxes/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/dialog-boxes/llms-full.txt

---

TX Text Control .NET for Windows Forms brings the dialog boxes of a word processor with it: font, paragraph, tabs, lists, styles, page setup, tables, images, find and replace and more. The ribbon tabs open them for the user, and your code opens each one with a single method call. Here you find which dialog boxes exist, how to open them on a certain tab, how to tell whether the user clicked **OK**, and how to change the separate dialog classes for bookmarks, hyperlinks and comments.

### How Built-In Dialog Boxes Work

Most dialog boxes are methods of the `TextControl` whose names end in `Dialog`, such as [FontDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/fontdialog-method/llms-full.txt). A dialog box works on the current selection or input position of the control and applies the user's settings when the user clicks **OK**. The method returns a `System.Windows.Forms.DialogResult`: `DialogResult.Cancel` when the user left with **Cancel**, otherwise `DialogResult.OK`.

The following screenshot shows the **Tabs** dialog box, which [TabDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/tabdialog-method/llms-full.txt) opens, in the TX Words sample:

![The Tabs dialog box in TX Words with a list of tab stop positions, the Leader list opened, the alignment options, a Right most tab check box and the buttons OK, Cancel, Set, Clear and Clear All.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-winforms/tabs-dialog.a13c7557.webp)

In the ribbon, groups such as **Font** and **Paragraph** show a small button in their lower right corner, visible in the screenshot. It is the dialog box launcher of the group, a [DialogBoxLauncher](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/dialogboxlauncher/llms-full.txt) object with a `Click` event. [Built-in Ribbon Tabs](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/ribbon/llms-full.txt) describes the tabs.

### Dialog Boxes of the TextControl

| Method | Dialog box | Condition |
|---|---|---|
| [FontDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/fontdialog-method/llms-full.txt) | Fonts and character attributes |  |
| [ParagraphFormatDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/paragraphformatdialog-method/llms-full.txt) | Alignment, spacing, indents, frames and pagination of paragraphs |  |
| [TabDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/tabdialog-method/llms-full.txt) | Tab stops |  |
| [ListFormatDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/listformatdialog-method/llms-full.txt) | Bulleted and numbered lists |  |
| [FormattingStylesDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/formattingstylesdialog-method/llms-full.txt) | Create, delete and modify formatting styles |  |
| [LanguageDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/languagedialog-method/llms-full.txt) | The language of the selected text |  |
| [AddSymbolDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/addsymboldialog-method/llms-full.txt) | Insert symbol characters |  |
| [ForeColorDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/forecolordialog-method/llms-full.txt), [TextBackColorDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/textbackcolordialog-method/llms-full.txt) | The text color and the background color of text |  |
| [FrameFillColorDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/framefillcolordialog-method/llms-full.txt), [FrameLineColorDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/framelinecolordialog-method/llms-full.txt) | The background color of a paragraph or table cell, and the frame color of a paragraph or table |  |
| [PageColorDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/pagecolordialog-method/llms-full.txt) | The page color |  |
| [SectionFormatDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/sectionformatdialog-method/llms-full.txt) | Page setup of a section: margins, size, headers and footers, columns and borders |  |
| [TableFormatDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/tableformatdialog-method/llms-full.txt) | Table lines, colors, distances, cell size, formulas and number formats | A table at the input position |
| [ImageAttributesDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/imageattributesdialog-method/llms-full.txt) | Layout, size and saving options of an image | A selected image |
| [TextFrameAttributesDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/textframeattributesdialog-method/llms-full.txt) | Layout, size and appearance of a text frame | A selected text frame |
| [ChartLayoutDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/chartlayoutdialog-method/llms-full.txt) | Layout and size of a chart | A selected chart |
| [BarcodeLayoutDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/barcodelayoutdialog-method/llms-full.txt) | Layout, size, colors, type and text of a barcode | A selected barcode |
| [DrawingLayoutDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/drawinglayoutdialog-method/llms-full.txt) | Layout, size, colors, rotation and transparency of a drawing | A selected drawing |
| [SignatureFieldLayoutDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/signaturefieldlayoutdialog-method/llms-full.txt) | Layout, size and image saving options of a signature field | A selected signature field |
| [TableOfContentsDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/tableofcontentsdialog-method/llms-full.txt) | Insert a table of contents, or change the one at the input position |  |
| [ConditionalInstructionDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/conditionalinstructiondialog-method/llms-full.txt), [ManageConditionalInstructionsDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/manageconditionalinstructionsdialog-method/llms-full.txt) | Create, edit and manage conditional instructions of form fields | [IsFormFieldValidationEnabled](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/isformfieldvalidationenabled-property/llms-full.txt) is `true`; for `ConditionalInstructionDialog`, the document also has form fields and `EditMode` isn't `ReadAndSelect` |
| [SpellCheckDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/spellcheckdialog-method/llms-full.txt) | Correct misspelled words | A spell checker connected through [SpellChecker](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/spellchecker-property/llms-full.txt) |

A few methods don't follow this pattern or return something else:

- [AddSymbolDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/addsymboldialog-method/llms-full.txt) and [SpellCheckDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/spellcheckdialog-method/llms-full.txt) return nothing.
- [LanguageDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/languagedialog-method/llms-full.txt) returns `DialogResult.None` when the selected language could not be set.
- The two conditional instruction methods return `DialogResult.Abort` when the dialog box could not be opened because a condition of the table above isn't met.
- [ListFormatDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/listformatdialog-method/llms-full.txt) also returns `DialogResult.Cancel` when nothing was changed.

#### Find, Replace, Open, Save and Print

Other methods open dialog boxes when they are called without the parameters that would otherwise do the work:

| Method | Dialog box |
|---|---|
| [Find](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/find-method/llms-full.txt)`()` | The built-in **Find** dialog box, searching the text part with the input focus |
| [Replace](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/replace-method/llms-full.txt)`()` | The built-in **Replace** dialog box |
| [Load](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/load-method/llms-full.txt)`()`, `Load(StreamType)` | A file **Open** dialog box, offering the given file formats |
| [Save](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/save-method/llms-full.txt)`()`, `Save(StreamType)` | A file **Save As** dialog box |
| [Print](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/print-method/llms-full.txt)`(string docName)` | The standard print dialog box |
| [PrintPreview](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/printpreview-method/llms-full.txt)`(string docName)` | A print preview of the document |

[Search and Replace](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/search-replace/llms-full.txt), [Loading and Saving](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/load-save/llms-full.txt) and [Printing](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/printing/llms-full.txt) cover these tasks in full.

### Open a Dialog Box From Code

The following handlers open the **Font** dialog box on its second tab and the table dialog box only when the input position is in a table. Connect them to the `Click` event of two buttons or menu items in *Form1.cs*:

```csharp
using System;
using System.Windows.Forms;
using TXTextControl;

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void FontButton_Click(object sender, EventArgs e)
    {
        // Open the tab for baseline position and text effects
        if (textControl1.FontDialog(1) == DialogResult.OK)
        {
            // Return the keyboard focus to the editor
            textControl1.Focus();
        }
    }

    private void TableButton_Click(object sender, EventArgs e)
    {
        // The table dialog box needs a table at the input position
        if (textControl1.Tables.GetItem() != null)
        {
            textControl1.TableFormatDialog(2);
        }
        else
        {
            MessageBox.Show("Place the input position in a table first.");
        }
    }
}
```

The code works as follows:

- `FontDialog(1)` opens the dialog box on the tab with index 1. Without a parameter, a tabbed dialog box opens on the tab that was open last.
- The result is compared with `DialogResult.OK`, which means the user confirmed the changes.
- [TableCollection.GetItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tablecollection/getitem-method/llms-full.txt) without parameters returns the table at the input position, or `null`. [ImageCollection.GetItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/imagecollection/getitem-method/llms-full.txt) and [TextFrameCollection.GetItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textframecollection/getitem-method/llms-full.txt) test the same way whether an image or a text frame is selected.
- `TableFormatDialog(2)` opens the tab for formulas and number formats.

#### Tabs of the Tabbed Dialog Boxes

The `activeTab` parameter is the zero-based index of the tab:

| Method | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| `FontDialog` | Font and its attributes | Baseline position and text effects |  |  |
| `ParagraphFormatDialog` | Alignment, line spacing, indents and distances | Frame and pagination |  |  |
| `SectionFormatDialog` | Margins, page size and orientation | Headers and footers | Page columns | Page borders |
| `TableFormatDialog` | Frame lines, color and distances | Vertical size and alignment | Formulas and number formats |  |
| `ImageAttributesDialog` | Text wrapping and layout | Size and distances | Saving attributes |  |
| `TextFrameAttributesDialog` | Text wrapping and layout | Size and distances | Frame line and background color |  |
| `ChartLayoutDialog` | Text wrapping and layout | Size and distances |  |  |
| `BarcodeLayoutDialog`, `DrawingLayoutDialog` | Text wrapping and layout | Size and distances | Further attributes such as colors |  |
| `SignatureFieldLayoutDialog` | Text wrapping and layout | Size and distances | Saving attributes of the signature image, if one is set |  |

`SectionFormatDialog(1)` opens the page setup on the **Headers and Footers** tab:

![The Page Setup dialog box on its Headers and Footers tab, with the Header list opened, Different header odd and even options, distances from the edge in inches and an Apply to list.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-winforms/page-setup-headers-footers.7b859779.webp)

### Measuring Units

The [DialogUnit](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/dialogunit-property/llms-full.txt) property sets the unit for sizes and distances in all dialog boxes: `Auto`, `Centimeter`, `Inch` or `Millimeter`. With `Auto`, the unit depends on the culture of the current thread.

```csharp
// Show sizes and distances in millimeters
textControl1.DialogUnit = DialogUnit.Millimeter;
```

### Options in the Save As Dialog Box

An overload of `Save` takes a [SaveSettings.DialogSettings](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/savesettings/dialogsettings-enumeration/llms-full.txt) value that adds options to the **Save As** dialog box, such as a password button for Adobe PDF, stylesheet options for HTML or a check box that saves only the selected text. [Loading and Saving Documents](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/load-save/#offer-options-in-the-save-as-dialog-box) shows the options and the code.

### Dialog Classes

Some dialog boxes are classes of their own that inherit from `System.Windows.Forms.Form`. You create them for a `TextControl` and show them modally with `ShowDialog` or modelessly with `Show`:

| Class | Dialog box | Shown with |
|---|---|---|
| [BookmarkDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/bookmarkdialog/llms-full.txt) | Insert a bookmark (a document target) at the input position, or rename the one there | `ShowDialog` |
| [DeleteBookmarksDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/deletebookmarksdialog/llms-full.txt) | List all targets, go to one or delete them | `ShowDialog` |
| [HyperlinkDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hyperlinkdialog/llms-full.txt) | Insert, edit or delete a hyperlink or a link to a target in the document | `ShowDialog` |
| [GotoDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/gotodialog/llms-full.txt) | Move the input position to a page, section, line, table or bookmark | `Show` |
| [CommentsDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentsdialog/llms-full.txt) | List all comments, reply to, edit or delete them | `Show` |
| [TrackedChangesDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/trackedchangesdialog/llms-full.txt) | List all tracked changes, accept or reject them | `Show` |
| [ThesaurusDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/thesaurusdialog/llms-full.txt) | Synonyms of the selected word | `ShowDialog` |

This is the hyperlink dialog box, opened for an existing link:

![The Edit Hyperlink dialog box with Text to display, Address with a Select file button, a Bookmarks list, the Show Bookmarks in options and the buttons Delete Hyperlink, OK and Cancel.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-winforms/hyperlink-dialog.20f921a5.webp)

`BookmarkDialog` and `HyperlinkDialog` throw an exception if nothing can be inserted or edited at the input position. The reference names the checks: `DocumentTargets.CanAdd` or a target at the input position for bookmarks, and `HypertextLinks.CanAdd` or a link at the input position for hyperlinks.

Each item of these dialog boxes has a name from the class's `DialogItem` enumeration, and `FindItem` returns the item as a `System.Windows.Forms.Control` so that you can move, change or remove it. The following code removes the check box that lets users mark a bookmark as deletable, then shows the dialog box:

```csharp
BookmarkDialog dialog = new BookmarkDialog(textControl1);

// Remove the check box before the dialog box is shown
Control deletable = dialog.FindItem(BookmarkDialog.DialogItem.TXITEM_Deletable);
deletable.Parent.Controls.Remove(deletable);

dialog.ShowDialog(this);
```

[BookmarkDialog.FindItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/bookmarkdialog/finditem-method/llms-full.txt) and [BookmarkDialog.DialogItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/bookmarkdialog/dialogitem-enumeration/llms-full.txt) list the items of this dialog box; the other classes have their own enumerations.

#### Adapt the Comments and Tracked Changes Dialog Boxes

The two modeless dialog boxes work the same way. [CommentsDialog.FindItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentsdialog/finditem-method/llms-full.txt) takes a value of [CommentsDialog.DialogItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentsdialog/dialogitem-enumeration/llms-full.txt), and [TrackedChangesDialog.FindItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/trackedchangesdialog/finditem-method/llms-full.txt) a value of [TrackedChangesDialog.DialogItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/trackedchangesdialog/dialogitem-enumeration/llms-full.txt). Both return `null` when the item isn't found:

| Dialog box | Its items |
|---|---|
| `CommentsDialog` | `TXITEM_CommentsCount` (the label with the number of comments), `TXITEM_CommentsRefresh`, `TXITEM_CommentsViewer` (the list of comments), `TXITEM_DeleteComment`, `TXITEM_DeleteAllComments`, `TXITEM_EditComment`, `TXITEM_ReplyComment` and `TXITEM_Close` |
| `TrackedChangesDialog` | `TXITEM_TrackedChangesCount` (the label with the number of changes), `TXITEM_TrackedChangesRefresh`, `TXITEM_TrackedChangesViewer` (the list of changes), `TXITEM_AcceptTrackedChange`, `TXITEM_AcceptAllTrackedChanges`, `TXITEM_RejectTrackedChange`, `TXITEM_RejectAllTrackedChanges` and `TXITEM_Close` |

The following handler opens the tracked changes dialog box for a reviewer who may accept single changes but not accept or reject all of them at once:

```csharp
private void reviewButton_Click(object sender, EventArgs e)
{
    TrackedChangesDialog dialog = new TrackedChangesDialog(textControl1);

    // Hide the buttons that act on all tracked changes
    Control acceptAll = dialog.FindItem(TrackedChangesDialog.DialogItem.TXITEM_AcceptAllTrackedChanges);
    Control rejectAll = dialog.FindItem(TrackedChangesDialog.DialogItem.TXITEM_RejectAllTrackedChanges);

    if (acceptAll != null) acceptAll.Visible = false;
    if (rejectAll != null) rejectAll.Visible = false;

    // Modeless: the user goes on working in the document
    dialog.Show(this);
}
```

The name of each `DialogItem` value is the `Name` of the control it identifies. For comments, `CommentsDialog.DialogItem.TXITEM_DeleteAllComments` finds the button that deletes every comment, which you hide the same way.

### Dialog Boxes of Fields

Two field classes open their own dialog boxes, which return a `Selection.DialogResult`:

- [FormField.FormFieldDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/formfield/formfielddialog-method/llms-full.txt) changes the formatting attributes of a form field.
- [PageNumberField.PageNumberDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/pagenumberfield/pagenumberdialog-method/llms-full.txt) changes the format and numbering of a page number field.

### Next Steps

- [Context Menus](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/context-menus/llms-full.txt): open dialog boxes from the right-click menu.
- [Localization and Resource Kit](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/localization/llms-full.txt): the language of the dialog boxes.
- [Right-to-Left UI](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/right-to-left/llms-full.txt): dialog boxes in a right-to-left layout.
- [Custom Tabs and Commands](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/custom-tabs/llms-full.txt): ribbon buttons that open dialog boxes.

---

## Nearby

- **Previous:** [Context Menus](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/context-menus/llms-full.txt)
- **Next:** [Themes, Colors, and Icons](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/themes/llms-full.txt)
