| IGLib 1.7.2 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Classes | Public Member Functions | Static Public Member Functions | Properties | Private Member Functions | Static Private Attributes | List of all members
IG.Forms.UtilForms Class Reference

Various forms utilities. More...

Collaboration diagram for IG.Forms.UtilForms:
[legend]

## Classes
class | WindowsAPI

## Public Member Functions
void | GenerateKeyPressTest1 (Control targetControl, string keyCode)
Icon | FileIcon (string filePath)
Icon | DllIcon (string DLLPath, int iconIndex)

## Static Public Member Functions
static Form | CreateFormFromControl (Control ctrl)
static void | GenerateKeyPress (Control targetControl, string keyCode)
| Sends the specified keystorkes to the specified control. More...
static bool | IsMainGuiThread ()
| Returns true if the currently executing thread is the main GUI thread with the message loop, and false otherwise. More...
static string | GetCurrentThreadInfo ()
static void | IdentifyCurrentThread (int showTimeMilliseconds=4000, bool topMost=false)
| Launches a fading message that contains identification information for the currently executing thread, in particular the ID. More...
static void | PrintControl (Control frm)
| Prints a control by a printer. More...
static void | SaveControlJpeg (Control frm, string filePath)
| Saves the specified control to the specified file in the JPG format (common extension .jpg). More...
static void | SaveControlJpeg (Control frm, string filePath, bool canOverwriteExistent)
| Saves the specified control to the specified file in the JPG format (common extension .jpg). More...
static void | SaveControlGif (Control frm, string filePath)
| Saves the specified control to the specified file in the GIF format (common extension .gif). More...
static void | SaveControlGif (Control frm, string filePath, bool canOverwriteExistent)
| Saves the specified control to the specified file in the GIF format (common extension .gif). More...
static void | SaveControlBmp (Control frm, string filePath)
| Saves the specified control to the specified file in the BMP format (common extension .bmp). More...
static void | SaveControlBmp (Control frm, string filePath, bool canOverwriteExistent)
| Saves the specified control to the specified file in the BMP format (common extension .bmp). More...
static void | SaveControl (Control frm, string filePath, ImageFormat format)
| Saves the specified control to the specified file in a specified bitmap format. More...
static void | SaveControl (Control frm, string filePath, ImageFormat format, bool canOverwriteExistent)
| Saves the specified control to the specified file in a specified bitmap format. More...
static string | SaveControlFileDialogJpeg (Control frm, string initialDirectoryPath)
| Saves the specified control to a file in the JPG format (common extension .jpg). The file is chosen by the user via a file dialog that is launched. More...
static string | SaveControlFileDialogJpeg (Control frm, string initialDirectoryPath, bool canOverwriteExistent)
| Saves the specified control to the specified file in the JPEG format (common extension .jpg). The file is chosen by the user via a file dialog that is launched. More...
static string | SaveControlFileDialogGif (Control frm, string initialDirectoryPath)
| Saves the specified control to a file in the GIF format (common extension .gif). The file is chosen by the user via a file dialog that is launched. More...
static string | SaveControlFileDialogGif (Control frm, string initialDirectoryPath, bool canOverwriteExistent)
| Saves the specified control to the specified file in the GIF format (common extension .gif). The file is chosen by the user via a file dialog that is launched. More...
static string | SaveControlFileDialogBmp (Control frm, string initialDirectoryPath)
| Saves the specified control to a file in the BMP format (common extension .bmp). The file is chosen by the user via a file dialog that is launched. More...
static string | SaveControlFileDialogBmp (Control frm, string initialDirectoryPath, bool canOverwriteExistent)
| Saves the specified control to the specified file in the BMP format (common extension .bmp). The file is chosen by the user via a file dialog that is launched. More...
static string | SaveControlFileDialog (Control frm, string initialDirectoryPath, string extension, ImageFormat format)
| Saves the specified control to a file. The is chosen by the user via a file dialog that is launched. More...
static string | SaveControlFileDialog (Control frm, string initialDirectoryPath, string extension, ImageFormat format, bool canOverwriteExistent)
| Saves the specified control's image to the specified file in a specified bitmap format. More...
static void | BlinkControl (Control control)
| Blinks the specified control with default number of blinks and blink interval. More...
static void | BlinkForm (Control control, int numBlinks, int blinkTimeMs)
| Blinks the specified control with the specified number of blinks and blink interval. More...
static void | RecursiveControlDelegate (Control frm, ControlDelegate fd)
| Recursively executes a dlegate of type (vod(Control)) on frm and all its children. More...
static void | SetBackColorRec (Control win, Color col)
| Recursively sets background color for the specified control and all its children. More...
static void | SetForeColorRec (Control win, Color col)
| Recursively sets foreground color for the specified control and all its children. More...
static void | ConsoleExample ()
static void | ConsoleExample2 ()

## Properties
static object | Lock`[get]`
| Global lock object for this class and for containing assembly. More...
static Font | DefaultFont`[get, set]`
| Default font used in forms. More...
static ConsoleForm | AppConsole`[get]`
| Global application's console. More...
static IG.Lib.IReporter | Reporter`[get]`
| Reporter that can be used by forms. More...

## Private Member Functions
ReporterForms | GetReporterForms ()

## Static Private Attributes
static object | _lock
| Common tools for Windows forms. More...
static Font | _defaultFont = null
static ConsoleForm | _appConsole
static IG.Lib.IReporter | _reporter = null
static ReporterForms | _reporterForms = null

## Detailed Description

Various forms utilities.

## Member Function Documentation

static Form IG.Forms.UtilForms.CreateFormFromControl | ( | Control | ctrl | ) |
| inline static

ReporterForms IG.Forms.UtilForms.GetReporterForms | ( |  | ) |
| inline private

static void IG.Forms.UtilForms.GenerateKeyPress | ( | Control | targetControl,
|  | string | keyCode
| ) |  |
| inline static

Sends the specified keystorkes to the specified control.

Examples: "A", "B", "F1", "{ENTER}", "{DELETE}", "{END}",

"^AB" - hold Ctrl while A is pressed, then press B

"+(AB)" (hold Shift while A and B are pressed),

"%{ENTER}" (hold Alt while Enter is pressed).

Parameters

  targetControl | Target control to which the keystrokes are sent.
  keyCode | A string specifying keys or sequence thereof to be sent to the control.

List of codes accepted:

http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx

Referenced by IG.Gr3d.VtkControlBase.SendKeys().

void IG.Forms.UtilForms.GenerateKeyPressTest1 | ( | Control | targetControl,
|  | string | keyCode
| ) |  |
| inline

static bool IG.Forms.UtilForms.IsMainGuiThread | ( |  | ) |
| inline static

Returns true if the currently executing thread is the main GUI thread with the message loop, and false otherwise.

This method works on the assumption that the main (entry) assemlly's entry method (i.e. main) is runnning on the thread where the main GUI thread was started. However, the main GUI message loop can also be started on another thread by calling Application.Run() or Form.ShowDialog().

Referenced by IG.Forms.ReporterForms.DefaultReport_FadeMessage(), IG.Forms.FadingMessage.ExampleLargeNum(), and IG.Forms.UtilForms.GetCurrentThreadInfo().

static string IG.Forms.UtilForms.GetCurrentThreadInfo | ( |  | ) |
| inline static

References IG.Forms.UtilForms.IsMainGuiThread().

Referenced by IG.Forms.ScalarFunctionEvaluatorControl.btnIdentifyThread_Click(), and IG.Forms.FadingMessage.menuIdentifyThread_Click().

static void IG.Forms.UtilForms.IdentifyCurrentThread | ( | int | showTimeMilliseconds = `4000`,
|  | bool | topMost = `false`
| ) |  |
| inline static

Launches a fading message that contains identification information for the currently executing thread, in particular the ID.

This makes possible to identify threads in which particular GUI components are executed, which is especially useful in situations when more than one message loops are running in separate threads (a common example is launching fading messages in parallel threads).

The fading message that contains information is launched in a parallel thread, which guarantees that the message is very responsive even in situations where the message loop is blocked by long running tasks.

Beside the thread ID, message also contains information about thread name (when specified) and information on whether the thread is the main GUI thread (which is established with some uncertainty, see the IsMainGuiThread() method.).

Parameters

  showTimeMilliseconds | Display time of the faiding message, in milliseconds.
  topMost | Whether the fading message window is launched as topmost window.

References IG.Forms.FadingMessage.IsTopMostWindow.

Referenced by IG.Forms.VectorFunctionPlotter1d.btnIdentifyThread_Click(), and IG.Forms.VectorFunctionPlotter2d.btnIdentifyThread_Click().

static void IG.Forms.UtilForms.PrintControl | ( | Control | frm | ) |
| inline static

Prints a control by a printer.

Parameters

  frm | Control to be printed.

static void IG.Forms.UtilForms.SaveControlJpeg | ( | Control | frm,
|  | string | filePath
| ) |  |
| inline static

Saves the specified control to the specified file in the JPG format (common extension .jpg).

The file is overwritten if it already exists.

Parameters

  frm | Control to be printed.
  inputFilePath | Path of the file where image is saved.

static void IG.Forms.UtilForms.SaveControlJpeg | ( | Control | frm,
|  | string | filePath,
|  | bool | canOverwriteExistent
| ) |  |
| inline static

Saves the specified control to the specified file in the JPG format (common extension .jpg).

canOverwriteExistent specifies whether existent files can be overritten.

Parameters

  frm | Control to be printed.
  inputFilePath | Path of the file where image is saved.
  canOverwriteExistent | Whether the method can override existent files.

If false and inputFilePath specifies an existent file then exception is thrown.

static void IG.Forms.UtilForms.SaveControlGif | ( | Control | frm,
|  | string | filePath
| ) |  |
| inline static

Saves the specified control to the specified file in the GIF format (common extension .gif).

The file is overwritten if it already exists.

Parameters

  frm | Control to be printed.
  inputFilePath | Path of the file where image is saved.

static void IG.Forms.UtilForms.SaveControlGif | ( | Control | frm,
|  | string | filePath,
|  | bool | canOverwriteExistent
| ) |  |
| inline static

Saves the specified control to the specified file in the GIF format (common extension .gif).

canOverwriteExistent specifies whether existent files can be overritten.

Parameters

  frm | Control to be printed.
  inputFilePath | Path of the file where image is saved.
  canOverwriteExistent | Whether the method can override existent files.

If false and inputFilePath specifies an existent file then exception is thrown.

static void IG.Forms.UtilForms.SaveControlBmp | ( | Control | frm,
|  | string | filePath
| ) |  |
| inline static

Saves the specified control to the specified file in the BMP format (common extension .bmp).

The file is overwritten if it already exists.

Parameters

  frm | Control to be printed.
  inputFilePath | Path of the file where image is saved.

static void IG.Forms.UtilForms.SaveControlBmp | ( | Control | frm,
|  | string | filePath,
|  | bool | canOverwriteExistent
| ) |  |
| inline static

Saves the specified control to the specified file in the BMP format (common extension .bmp).

canOverwriteExistent specifies whether existent files can be overritten.

Parameters

  frm | Control to be printed.
  inputFilePath | Path of the file where image is saved.
  canOverwriteExistent | Whether the method can override existent files.

If false and inputFilePath specifies an existent file then exception is thrown.

static void IG.Forms.UtilForms.SaveControl | ( | Control | frm,
|  | string | filePath,
|  | ImageFormat | format
| ) |  |
| inline static

Saves the specified control to the specified file in a specified bitmap format.

The file is overwritten if it already exists.

Parameters

  frm | Control to be printed.
  inputFilePath | Path of the file where image is saved.
  format | Image format.

static void IG.Forms.UtilForms.SaveControl | ( | Control | frm,
|  | string | filePath,
|  | ImageFormat | format,
|  | bool | canOverwriteExistent
| ) |  |
| inline static

Saves the specified control to the specified file in a specified bitmap format.

canOverwriteExistent specifies whether existent files can be overritten.

Parameters

  frm | Control to be printed.
  inputFilePath | Path of the file where image is saved.
  format | Image format.
  canOverwriteExistent | Whether the method can override existent files.

If false and inputFilePath specifies an existent file then exception is thrown.

static string IG.Forms.UtilForms.SaveControlFileDialogJpeg | ( | Control | frm,
|  | string | initialDirectoryPath
| ) |  |
| inline static

Saves the specified control to a file in the JPG format (common extension .jpg). The file is chosen by the user via a file dialog that is launched.

The file is overwritten if it already exists.

Parameters

  frm | Control to be printed.
  initialDirectoryPath | Initial directory opened in file dialog. Set to current directory if not specified.

Returns
  Path to the file to which the control image was saved, or null if it was not saved.

static string IG.Forms.UtilForms.SaveControlFileDialogJpeg | ( | Control | frm,
|  | string | initialDirectoryPath,
|  | bool | canOverwriteExistent
| ) |  |
| inline static

Saves the specified control to the specified file in the JPEG format (common extension .jpg). The file is chosen by the user via a file dialog that is launched.

canOverwriteExistent specifies whether existent files can be overritten.

Parameters

  frm | Control to be printed.
  initialDirectoryPath | Initial directory opened in file dialog. Set to current directory if not specified.
  canOverwriteExistent | Whether the method can override existent files.

If false and an existent file is selected then exception is thrown.

Returns
  Path to the file to which the control image was saved, or null if it was not saved.

static string IG.Forms.UtilForms.SaveControlFileDialogGif | ( | Control | frm,
|  | string | initialDirectoryPath
| ) |  |
| inline static

Saves the specified control to a file in the GIF format (common extension .gif). The file is chosen by the user via a file dialog that is launched.

The file is overwritten if it already exists.

Parameters

  frm | Control to be printed.
  initialDirectoryPath | Initial directory opened in file dialog. Set to current directory if not specified.

Returns
  Path to the file to which the control image was saved, or null if it was not saved.

static string IG.Forms.UtilForms.SaveControlFileDialogGif | ( | Control | frm,
|  | string | initialDirectoryPath,
|  | bool | canOverwriteExistent
| ) |  |
| inline static

Saves the specified control to the specified file in the GIF format (common extension .gif). The file is chosen by the user via a file dialog that is launched.

canOverwriteExistent specifies whether existent files can be overritten.

Parameters

  frm | Control to be printed.
  initialDirectoryPath | Initial directory opened in file dialog. Set to current directory if not specified.
  canOverwriteExistent | Whether the method can override existent files.

If false and an existent file is selected then exception is thrown.

Returns
  Path to the file to which the control image was saved, or null if it was not saved.

static string IG.Forms.UtilForms.SaveControlFileDialogBmp | ( | Control | frm,
|  | string | initialDirectoryPath
| ) |  |
| inline static

Saves the specified control to a file in the BMP format (common extension .bmp). The file is chosen by the user via a file dialog that is launched.

The file is overwritten if it already exists.

Parameters

  frm | Control to be printed.
  initialDirectoryPath | Initial directory opened in file dialog. Set to current directory if not specified.

Returns
  Path to the file to which the control image was saved, or null if it was not saved.

static string IG.Forms.UtilForms.SaveControlFileDialogBmp | ( | Control | frm,
|  | string | initialDirectoryPath,
|  | bool | canOverwriteExistent
| ) |  |
| inline static

Saves the specified control to the specified file in the BMP format (common extension .bmp). The file is chosen by the user via a file dialog that is launched.

canOverwriteExistent specifies whether existent files can be overritten.

Parameters

  frm | Control to be printed.
  initialDirectoryPath | Initial directory opened in file dialog. Set to current directory if not specified.
  canOverwriteExistent | Whether the method can override existent files.

If false and inputFilePath specifies an existent file then exception is thrown.

Returns
  Path to the file to which the control image was saved, or null if it was not saved.

static string IG.Forms.UtilForms.SaveControlFileDialog | ( | Control | frm,
|  | string | initialDirectoryPath,
|  | string | extension,
|  | ImageFormat | format
| ) |  |
| inline static

Saves the specified control to a file. The is chosen by the user via a file dialog that is launched.

The file is overwritten if it already exists.

Parameters

  frm | Control to be printed.
  initialDirectoryPath | Initial directory opened in file dialog. Set to current directory if not specified.
  extension | File extension (e.g. ".bmp").
  format | Image format.

Returns
  Path to the file to which the control image was saved, or null if it was not saved.

static string IG.Forms.UtilForms.SaveControlFileDialog | ( | Control | frm,
|  | string | initialDirectoryPath,
|  | string | extension,
|  | ImageFormat | format,
|  | bool | canOverwriteExistent
| ) |  |
| inline static

Saves the specified control's image to the specified file in a specified bitmap format.

canOverwriteExistent specifies whether existent files can be overritten.

Parameters

  frm | Control to be printed.
  initialDirectoryPath | Initial directory opened in file dialog. Set to current directory if not specified.
  extension | File extension (e.g. ".bmp").
  inputFilePath | Path of the file where image is saved.
  format | Image format.
  canOverwriteExistent | Whether the method can override existent files.

If false and inputFilePath specifies an existent file then exception is thrown.

Returns
  Path to the file to which the control image was saved, or null if it was not saved.

static void IG.Forms.UtilForms.BlinkControl | ( | Control | control | ) |
| inline static

Blinks the specified control with default number of blinks and blink interval.

Parameters

  control | Control to be blinked.

Referenced by IG.Gr3d.Graph3dManipulator.btnClose_Click(), IG.Gr3d.Graph3dManipulatorBasic.btnCloseWin_Click(), IG.Forms.WindowPositionerControl.MakeWindowsVisible(), IG.Forms.XmlTreeViewControl.MenuTools_TestXPath_Click(), IG.Forms.XMLTreeViewFormOld_Keep_Some_time.MenuTools_TestXPath_Click(), IG.Gr3d.Graph3dManipulator.txtFi_Validated(), IG.Forms.WindowPositionerControl.txtPause_Validated(), IG.Gr3d.Graph3dManipulator.txtR_Validated(), IG.Gr3d.Graph3dManipulator.txtRoll_Validated(), IG.Gr3d.Graph3dManipulator.txtRotationStep_Validated(), IG.Gr3d.Graph3dManipulator.txtTheta_Validated(), IG.Gr3d.Graph3dManipulator.txtViewAngle_Validated(), and IG.Gr3d.Graph3dManipulator.txtZoomFactor_Validated().

static void IG.Forms.UtilForms.BlinkForm | ( | Control | control,
|  | int | numBlinks,
|  | int | blinkTimeMs
| ) |  |
| inline static

Blinks the specified control with the specified number of blinks and blink interval.

Parameters

  numBlinks | Number of blinks (exchanges of normal color / blink color).
  control | Control that is blinked.

References IG.Forms.ControlManipulator.Blink().

Referenced by IG.Forms.XMLTreeView.MenuTools_TestXPath_Click().

static void IG.Forms.UtilForms.RecursiveControlDelegate | ( | Control | frm,
|  | ControlDelegate | fd
| ) |  |
| inline static

Recursively executes a dlegate of type (vod(Control)) on frm and all its children.

Referenced by IG.Forms.ReporterConf.ConsoleForm_Load(), IG.Forms.ReporterConfigurationForm.ConsoleForm_Load(), IG.Forms.FadingMessageOld.FadeMessage_Load(), and IG.Forms.FadingMessage.FadeMessage_Load().

static void IG.Forms.UtilForms.SetBackColorRec | ( | Control | win,
|  | Color | col
| ) |  |
| inline static

Recursively sets background color for the specified control and all its children.

Parameters

  win | Control for which the background color is set.
  col | Background color to be set.

Referenced by IG.Forms.FadingMessageOld.FadeMessage_Load(), IG.Forms.FadingMessage.FadeMessage_Load(), IG.Forms.FadingMessageOld.SetFadeLevel(), and IG.Forms.FadingMessage.SetFadeLevel().

static void IG.Forms.UtilForms.SetForeColorRec | ( | Control | win,
|  | Color | col
| ) |  |
| inline static

Recursively sets foreground color for the specified control and all its children.

Parameters

  win | Control for which the background color is set.
  col | Background color to be set.

Icon IG.Forms.UtilForms.FileIcon | ( | string | filePath | ) |
| inline

Icon IG.Forms.UtilForms.DllIcon | ( | string | DLLPath,
|  | int | iconIndex
| ) |  |
| inline

static void IG.Forms.UtilForms.ConsoleExample | ( |  | ) |
| inline static

References IG.Forms.UtilForms.AppConsole, and IG.Forms.ConsoleForm.WriteLine().

static void IG.Forms.UtilForms.ConsoleExample2 | ( |  | ) |
| inline static

References IG.Forms.UtilForms.AppConsole, IG.Forms.ConsoleForm.ReadLine(), IG.Forms.UtilForms.Reporter, IG.Forms.ConsoleForm.ReportError(), and IG.Forms.ConsoleForm.WriteLine().

## Member Data Documentation

object IG.Forms.UtilForms._lock
| static private

Common tools for Windows forms.

Font IG.Forms.UtilForms._defaultFont = null
| static private

ConsoleForm IG.Forms.UtilForms._appConsole
| static private

IG.Lib.IReporter IG.Forms.UtilForms._reporter = null
| static private

ReporterForms IG.Forms.UtilForms._reporterForms = null
| static private

## Property Documentation

object IG.Forms.UtilForms.Lock
| static get

Global lock object for this class and for containing assembly.

Font IG.Forms.UtilForms.DefaultFont
| static get set

Default font used in forms.

Referenced by IG.Forms.ControlPropertyStore.ControlPropertyStore().

ConsoleForm IG.Forms.UtilForms.AppConsole
| static get

Global application's console.

WARNING: use should be avoided until ConsoleForm class is tested enough.

Referenced by IG.Forms.UtilForms.ConsoleExample(), IG.Forms.UtilForms.ConsoleExample2(), IG.Forms.ReporterForms.DefaultReport_ConsoleForm(), and IG.Forms.ReporterForms.DefaultReserveReportErrorForms().

IG.Lib.IReporter IG.Forms.UtilForms.Reporter
| static get

Reporter that can be used by forms.

Referenced by IG.Forms.ScalarFunctionEvaluatorControl.btnShowDefinition_Click(), IG.Forms.IndicatorLightTestControl.chkBusy_CheckedChanged(), IG.Forms.IndicatorLightTestControl.chkError_CheckedChanged(), IG.Forms.IndicatorLightTestControl.chkOff_CheckedChanged(), IG.Forms.IndicatorLightTestControl.chkOk_CheckedChanged(), IG.Forms.UtilForms.ConsoleExample2(), IG.Forms.ConsoleForm.Example(), and IG.Script.AppExtBase.FormDemoFunctionLaunchReport().

The documentation for this class was generated from the following file:

- igforms/Basic/UtilForms.cs