ForegroundColor property (WinStudio scripts)
Applies To
- IWSForm interface
- IWSFormComponent interface
Definition
Sets or returns the foreground color of a form or component.
Set Syntax
object.ForegroundColor = string
Get Syntax
object.ForegroundColor
| Part | Description | 
| object | Required. A reference to a valid form object or component object. | 
| string | Optional. A reference that resolves to a string containing the RGB code for the color. See "Remarks". | 
Remarks
A foreground color value is a comma-delimited RGB specification
		  (Red,Green,Blue). Format: 
		  "rrR,ggG,bbB" 
		       
Form objects: Text in labels for fields, buttons, grid-column heads, and other components displays in the "foreground color." The property corresponds to the foreground color override setting in the Form Properties dialog box.
Component objects: Text in a component displays in the foreground color. This property corresponds to the foreground color setting in the Form Component Properties dialog box.
Examples
This is a form-level example:
Sub Main()
   Application.ShowMessage("Current form background color = " & ThisForm.BackgroundColor _
     & vbLf & "Current form foreground color = " & ThisForm.ForegroundColor)
   ThisForm.BackgroundColor = "240,240,240"
   ThisForm.ForegroundColor = "0,64,128"
   Application.ShowMessage("Background color changed to = " & ThisForm.BackgroundColor _
      & vbLf & "Foreground color changed to " & ThisForm.ForegroundColor)
End Sub
This is a component-level example:
Sub Main()
   Dim oComponent As IWSFormComponent
   oComponent = ThisForm.Components("ScriptButton")
   If oComponent.ForegroundColor = "255,0,0" Then
      Application.ShowMessage("The foreground color is: " & _
         oComponent.ForegroundColor & vbLf & _
         "Now switching to default foreground color.")
      ThisForm.Components("ScriptButton").ForegroundColor = ""
   Else
      Application.ShowMessage("The foreground color is: " & _
         oComponent.ForegroundColor & vbLf & _
         "Now switching to red.")
      ThisForm.Components("ScriptButton").ForegroundColor = "255,0,0"
   End If
End Sub