Partilhar via


FormListControl.foregroundColor Method

Definition

Overloads

foregroundColor()

Gets or sets the text color for the control.

foregroundColor(Int32)

foregroundColor()

Gets or sets the text color for the control.

public:
 virtual int foregroundColor();
public virtual int foregroundColor ();
abstract member foregroundColor : unit -> int
override this.foregroundColor : unit -> int
Public Overridable Function foregroundColor () As Integer

Returns

An integer that contains a packed RGB color.

Remarks

The integer that is returned contains a packed RGB color as follows:

  • The low-order byte contains a value for the relative intensity of red.
  • The second byte contains a value for green.
  • The third byte contains a value for blue.
  • The high-order byte must be 0 (zero).
  • The maximum value for a single byte is 255.

The following example shows a call to the foregroundColor method to set the foreground color to the color of the menu text on the desktop. The while select statement retrieves account numbers from the CustTable table and then stores the data in a container. The items in the variable are added to the form list control by calling the FormListControl.addItem method.

static void createForm2(Args _args) 
{ 
    Args args; 
    Form form; 
    FormRun formRun; 
    FormBuildDesign formBuildDesign; 
    FormBuildDataSource formBuildDataSource; 
    FormBuildListControl formBuildListControl; 
    FormListControl formListControl; 
    FormListItem formListItem; 
    FormListColumn formListColumn; 
    int idx4; 
    str string; 
    container conAccountNum; 
    DictTable dictTable; 
    CustTable custTable; 
    int numAccounts; 
    int i; 
    int item; 
    int numItems; 
    // Create the form header. 
    form = new Form(); 
    // Add data sources to the form. 
    dictTable = new DictTable(tableNum(custTable)); 
    formBuildDataSource = form.addDataSource(dictTable.name()); 
    formBuildDataSource.table(dictTable.id()); 
    // Create the form design. 
    formBuildDesign = form.addDesign("Design"); 
    formBuildDesign.caption("myForm"); 
    // Add a form list control. 
    formBuildListControl = 
 formBuildDesign.addControl(FormControlType::ListView,"List"); 
    idx4 = formBuildListControl.id(); 
    args = new Args(); 
    args.object(form); 
    // Create the run-time form. 
    formRun = classfactory.formRunClass(args); 
    formRun.run(); 
    formRun.detach(); 
    formListControl = formRun.control(idx4); 
    formListControl.foregroundColor(WindowsPalette::MenuText); 
    formListControl.viewType(FormListViewType::Report); 
    formListControl.height(120); 
    formListControl.widthMode(FormWidth::ColumnWidth); 
    // Add a column to the form list control. 
    formListControl.addColumn(1, new FormListColumn("Column1")); 
    // Add items to the form list control. 
    while select custTable 
        where custTable.AccountNum >= 
 "4000" && custTable.AccountNum <= "4040" 
    { 
        conAccountNum += [[custTable.AccountNum]]; 
    } 
    numAccounts = conlen(conAccountNum); 
    for(i = 1; i <= numAccounts; i++) 
    { 
        string = conPeek(conAccountNum,i); 
        formListItem = new FormListItem(string); 
        item = formListControl.addItem(formListItem); 
    } 
}

Applies to

foregroundColor(Int32)

public:
 virtual int foregroundColor(int _value);
public virtual int foregroundColor (int _value);
abstract member foregroundColor : int -> int
override this.foregroundColor : int -> int
Public Overridable Function foregroundColor (_value As Integer) As Integer

Parameters

_value
Int32

An Integer data type that specifies the foreground color.

Returns

Applies to