.

Control Helpers (for Windows Forms)


Overview

The MpxUtil.Control class contains shared methods used to work with Windows Forms Controls.

Shared (or Static in C#) methods are methods that do not require an object. In this sense, they are similar to free functions in other programming languages. The .NET platform does not have free functions.

 

Control.SetText

.NET requires that properties of Windows Forms Controls are set in the thread of execution where they were created. SetText will safely set the Text property of Windows Forms Controls no matter which thread SetText is called from.

Visual Basic

Public Shared Sub SetText(ByVal ctrl As Windows.Forms.Control, 
                          ByVal text As String) 

C#

public static void SetText(Windows.Forms.Control ctrl, string text)

 

Control.Enable

.NET requires that properties of Windows Forms Controls are set in the thread of execution where they were created. Enable will safely set the Enabled property of Windows Forms Controls to True, enabling the control, no matter which thread Enable is called from.

Visual Basic

Public Shared Sub Enable(ByVal ctrl As Windows.Forms.Control)

C#

public void Enable(Windows.Forms.Control ctrl, string text)

 

Control.Disable

.NET requires that properties of Windows Forms Controls are set in the thread of execution where they were created. Disable will safely set the Enabled property of Windows Forms Controls to False, disabling the control, no matter which thread Disable is called from.

Visual Basic

Public Shared Sub Disable(ByVal ctrl As Windows.Forms.Control)

C#

public void Disable(Windows.Forms.Control ctrl, string text)

 

Control.SetEnabled

.NET requires that properties of Windows Forms Controls are set in the thread of execution where they were created. SetEnabled will safely set the Enabled property of Windows Forms Controls no matter which thread SetEnabled is called from.

Visual Basic

Public Shared Sub SetEnabled(ByVal ctrl As Windows.Forms.Control,
              ByVal value As Boolean) 

C#

public static void SetEnabled(Windows.Forms.Control ctrl,
              string text)

 

Control.FindControllerComponent

FindControllerComponent is useful when creating custom GUI controls. It finds the MPX Controller component that exists on the same Windows Form that the control ctrl is on. The optional name argument is used to find a controller object of a specific name. This is useful when a form has multiple MPX Controller components.

Visual Basic

Public Shared Function FindControllerComponent( 
              ByVal ctrl As Windows.Forms.Control) As Mpx.Controller


Public Shared Function FindControllerComponent( 
              ByVal ctrl As Windows.Forms.Control,
              ByVal name As String) As Mpx.Controller  

C#

public static Mpx.Controller FindControllerComponent(
              Windows.Forms.Control ctrl) 

public static Mpx.Controller FindControllerComponent(
              Windows.Forms.Control ctrl, string name) 

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2008 Motion Engineering