# Form

A `Form` is a representation of any window displayed in your application. The `Form` class can be used to create standard, tool, borderless, and floating windows. You can also use the `Form` class to create modal windows such as a dialog box. A special kind of form, the multiple-document interface (MDI) form, can contain other forms called MDI child forms. An MDI form is created by setting the `IsMdiContainer` property to `true`. MDI child forms are created by setting the `MdiParent` property to the MDI parent form that will contain the child form.

Using the properties available in the `Form` class, you can determine the appearance, size, color, and window management features of the window or dialog box you are creating. The `Text` property allows you to specify the caption of the window in the title bar. The `Size` and `Location` properties allow you to define the size and position of the window when it is displayed. You can use the `ForeColor` property to change the default foreground color of all controls placed on the form. The `FormBorderStyle`, `MinimizeBox`, and `MaximizeBox` properties allow you to control whether the form can be minimized, maximized, or resized at run time.

![Form designer showing pixel-perfect layout capabilities](/files/-Mja8YN_5V77XCx1uCGx)

{% hint style="info" %}
For a full list of properties, methods and events see the [API documentation.](http://docs.wisej.com/api)
{% endhint %}

## Features

### Container

Similar to WinForms, the `Form` control acts as a container for any other Wisej.NET control and can be manipulated in the designer to fit its contents.

![Form demonstrating container capabilities with multiple child controls](/files/-Mja8K58a0towHvLcy_k)

### Modal Dialog

Modal Dialogs are used to demand an action from a user. They draw the user's attention away from other parts of the form and require the user to attend to an action.

A `Form` control can be shown as a modal dialog by calling the `ShowDialog()` method.

{% tabs %}
{% tab title="C#" %}

```csharp
// create and show a modal form.
var form = new MyForm();
var result = form.ShowDialog();
if (result == DialogResult.OK)
    AlertBox.Show("Success");
    
// or

// create and dispose of a form upon completion.
using (var form = new MyForm())
    if (form.ShowDialog() == DialogResult.OK)
        AlertBox.Show("Success");
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Modal dialogs are not disposed when closed. **They are reusable.** If you don't intend to reuse a modal dialog call `Dispose()` when closed or use the [using](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-statement) pattern.
{% endhint %}

### Modal Form

The `Form` can also be shown in a manner that simulates a modal-appearance without the modal functionality.

Simply set the `ModalMask` property to `true` and call the Form's `Show()` method.

An optional callback can be specified upon completion:

{% tabs %}
{% tab title="C#" %}

```csharp
var form = new MyForm
{
    ShowModalMask = true
};
form.Show((form, result) => AlertBox.Show(result.ToString()));
```

{% endtab %}
{% endtabs %}

## Advanced

### JavaScript Widget

| Item                | Description                                                                                                                                                                                                                                                                                                                                                                   |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Class name          | "wisej.web.Form"                                                                                                                                                                                                                                                                                                                                                              |
| Theme appearance    | "window", see [Themes](https://docs.wisej.com/theme-builder/theme-elements/elements).                                                                                                                                                                                                                                                                                         |
| Child components    | "captionbar", "title" is the title of the window, "icon" is the icon in the left top corner of the window, "minimize-button" is minimize button, "close-button" is the close button, "maximize-button" is the maximize button, "restore-button" is the restore button, "pane" is the content part of the window. See [JavaScript](/docs/concepts/javascript-object-model.md). |
| Toolcontainer state | "caption", see [Embedded Tools](/docs/controls/general/embedded-tools.md).                                                                                                                                                                                                                                                                                                    |
| Source code         | [https://github.com/iceteagroup/wisej-js](https://github.com/iceteagroup/wisej-js/blob/master/wisej.web.TextBox.js)                                                                                                                                                                                                                                                           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/docs/controls/containers/form.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
