UtilForms Class

Contains Graphical User-Interface related utilities.

Definition

Namespace: DevCase.Core.Application.Forms
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public sealed class UtilForms
Inheritance
Object    UtilForms

Properties

Forms Gets a collection that contains all the declared Forms of the current assembly.
IsAppExecutedFromConsole Gets a value indicating whether the user has executed the current application from the Windows CMD.
TaskbarMaxValue Gets or sets the Taskbar maximum value of the current application.
TaskbarStatus Gets or sets the Taskbar status of the current application.
TaskbarValue Gets or sets the Taskbar value of the current application.

Methods

ActivateFullscreen Cause the specified Form to enter in Fullscreen mode.
AllocateConsole Allocates a new console for the calling process.
AnimateWindow Produces special effects when showing or hiding a window.

This doesn't show the window so make sure you call Show or set Visible property to after calling AnimateWindow(IWin32Window, Int32, WindowAnimation).

CenterToControl Centers the bounds of a source Control to a target Control.
CenterToScreen(Control) Centers the bounds of the specified Control (normally a Form) to the current screen.
CenterToScreen(Control, Screen) Centers the bounds of the specified Control (normally a Form) to the target screen.
ControlInvokeT Synchronouslly Executes an encapsulated method on the thread that owns the specified control.

This method avoids cross-threading exceptions.

ControlInvokeAsyncT Asynchronously Executes an encapsulated method on the thread that owns the specified control.

This method avoids cross-threading exceptions.

DeactivateFullscreen Cause the specified Form to exit from Fullscreen mode.
DoEventsSafe Processes all Windows messages currently in the message queue of the GUI.

This method greatly boosts the performance of any application in difference to DoEvents method.

When calling DoEvents to make the UI responsive, it generally decreases application performance;

however, using this method, we make sure there is at least one input event (keyboard or mouse) that needs to be processed before internally calling DoEvents.

EnableDoubleBufferedOnControlT Enables double buffering on the specified control.

Double buffering indicates whether a control should redraw its surface using a secondary buffer to reduce or prevent flicker.

Equals Determines whether the specified object is equal to the current object.
(Inherited from Object)
Fade Fades in or fades out a Form.
ForceMessageQueuePump This method allows the current thread to perform long-running operations while continuing to perform standard COM and SendMessage pumping.

Calling this method during a long-running operation will prevent the Managed Debugging Assistant (MDA) 'ContextSwitchDeadlock' error to occur while debugging your solution.

This error may occur when the thread that owns the destination context/apartment is processing a very long-running operation without pumping Windows messages for a specific period of time.

For example, you will use this method while performing a long-running operation with COM objects (eg. inside a "infinite" loop) that is blocking the UI thread,

so it is unabling the UI thread to pump window messages as they arrive, causing the 'ContextSwitchDeadlock' error to occur in the Visual Studio debugger after 60 seconds.

GetControlFromPoint(Control) Gets the corresponding control (if any) that is over the specified mouse point.
GetControlFromPoint(Form) Gets the corresponding control (if any) that is over the current mouse point.
GetControlFromPoint(Control, Point) Gets the corresponding control (if any) that is over the specified mouse point.
GetControlFromPoint(Form, Point) Gets the corresponding control (if any) that is over the specified point.
GetCursorPanDirection Translates the direction from one Point to another into a pan Cursor.

For example, comparing Point(x:=0, y:=1) with Point(x:=0, y:=2) will return PanSouth. (PanEast, PanWest, PanNorth, PanSouth, etc).

GetHashCode Serves as the default hash function.
(Inherited from Object)
GetNonClientAreaMargins(Control) Gets the non-client area margins of a Control.
GetNonClientAreaMargins(Form) Gets the non-client area margins of a Form.
GetNotifyIconHandle Gets the handle of the specified NotifyIcon.
GetNotifyIconRect Gets the screen coordinates of the bounding Rectangle of the specified NotifyIcon.
GetType Gets the Type of the current instance.
(Inherited from Object)
IsFullscreen(Form) Determine whether the specified form is running in fullscreen mode.
IsFullscreen(IntPtr) Determine whether the specified window is running in fullscreen mode.
IsFullscreen(Process) Determine whether the specified process is running in fullscreen mode.
LoadCursorFromFile(FileInfo) Creates a Cursor based on a cursor file.
LoadCursorFromFile(String) Creates a Cursor based on a cursor file.
LoadCursorFromResource Creates a Cursor based on the data contained in a managed .NET resource.
MinimizeToSystray Minimizes the specified Form to system-tray.
MouseIsOverControl Determinates whether the mouse pointer is inside the boundaries of a specified control.
MoveToScreen Moves the specified Control (normally a Form) to the target screen.
RestoreFromSystray Restores the visibility of the specified Form from system-tray.
RoundBorders(Control, Int32) Rounds the borders of a Control.
RoundBorders(Form, Int32) Rounds the borders of a Form.

Note that the FormBorderStyle form's property should be set to None.

ShakeControl Shakes the window of a Control during the specified amount of time.
ShakeForm Shakes the window of a Form during the specified amount of time.
ShowSaveFileDialog Opens a SaveFileDialog dialog and returns the selected filepath.
ToggleFormSystray Toggles the visibility of the specified Form to minimize it to system-tray or restore it from system-tray.
ToggleFullscreen Toggles the Fullscreen mode of the specified Form.
ToString Returns a string that represents the current object.
(Inherited from Object)

Extension Methods

CanConvertTo Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
CanConvertToT Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
ConvertToT Converts an object to the specified target type.

If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions)

ConvertToT Converts an object to the specified target type.

If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions)

IsDisposable Determines whether the specified object is a disposable type (i.e., it implements IDisposable interface).
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
ThrowIfNullTException Throws the specified exception if the source object is null.
(Defined by ObjectExtensions)

See Also