Table of Contents

Class Form

Namespace
Ranorex
Assembly
Ranorex.Core.dll

Represents an application main window or a dialog window.

public class Form : Adapter, IAdapter
Inheritance
Form
Implements
Inherited Members

Constructors

Form()

Creates a new Form adapter instance. This constructor is used internally by the Ranorex Core Framework for performance issues!

protected Form()

Form(Element)

Creates a new Form adapter instance.

public Form(Element element)

Parameters

element Element

The element to create the adapter for.

Exceptions

NullReferenceException

If element is null.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.

Properties

Active

True if the form is the currently active window.

public virtual bool Active { get; }

Property Value

bool

AppIcon

The application icon if available.

public virtual Icon AppIcon { get; }

Property Value

Icon

RequiredCapabilities

Capabilities required by the adapter implementation.

protected override string[] RequiredCapabilities { get; }

Property Value

string[]

State

The state of the form or application window.

public virtual FormWindowState State { get; set; }

Property Value

FormWindowState

Exceptions

SetAttributeFailedException

Thrown if setting the attribute value failed.

Title

The title of the form or application window.

public virtual string Title { get; }

Property Value

string

Methods

Activate()

Activates the form by bringing it to the foreground.

public virtual void Activate()

Exceptions

ActionFailedException

Thrown if invoking the action failed.

Close()

Closes the form.

public virtual void Close()

Exceptions

ActionFailedException

Thrown if invoking the action failed.

FromElement(Element)

Converts an Element to an instance of this class.

public static Form FromElement(Element element)

Parameters

element Element

The element to convert.

Returns

Form

The Form.

Exceptions

ArgumentNullException

If element is null.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.

FromPath(string)

Converts a string to an instance of this class by searching the root.

public static Form FromPath(string path)

Parameters

path string

The search path.

Returns

Form

The Form.

Remarks

The DefaultSearchTimeout is used to search for the specified path.

Exceptions

ArgumentNullException

If path is null.

RxPathException

If the specified path is not valid.

ElementNotFoundException

If no element is found.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.

Maximize()

Maximizes the form.

public void Maximize()

Minimize()

Minimizes the form.

public void Minimize()

Move(int, int)

Moves the form to a new location.

public virtual void Move(int x, int y)

Parameters

x int

The new x (left) position of the form.

y int

The new y (top) position of the form.

Exceptions

ActionFailedException

Thrown if invoking the action failed.

Resize(int, int)

Sets the size of the form.

public virtual void Resize(int width, int height)

Parameters

width int

The new width of the form.

height int

The new height of the form.

Exceptions

ActionFailedException

Thrown if invoking the action failed.

Restore()

Restores the form, i.e. sets its State to Normal.

public void Restore()

Operators

implicit operator Form(Element)

Implicitly converts an Element to an instance of this class.

public static implicit operator Form(Element element)

Parameters

element Element

The element to convert.

Returns

Form

The Form.

Exceptions

ArgumentNullException

If element is null.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.

implicit operator Form(string)

Implicitly converts a string to an instance of this class by searching the root.

public static implicit operator Form(string path)

Parameters

path string

The search path.

Returns

Form

The Form.

Remarks

The DefaultSearchTimeout is used to search for the specified path.

Exceptions

ArgumentNullException

If path is null.

RxPathException

If the specified path is not valid.

ElementNotFoundException

If no element is found.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.