Skip to main content

Form

WATCH & LEARN0:50 · Animated tutorial
7 scenesPlay, pause, or scrub at your own pace

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

info

For a complete list of properties, methods, and events, see the API documentation.

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

A modal dialog requires the user to complete or cancel an interaction before returning to the rest of the application.

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

// 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");
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 pattern.

You can also show a Form with a modal mask without suspending the calling code.

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

Supply an optional callback to handle completion:

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

Advanced​

JavaScript Widget​

ItemDescription
Class name"wisej.web.Form"
Theme appearance"window", see Themes.
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.
Toolcontainer state"caption", see Embedded Tools.
Source codehttps://github.com/iceteagroup/wisej-js