property ExMenu.item (ID as Variant) as Item
Finds the item given its identifier or its name.

TypeDescription
ID as Variant A long expression that indicates the item's identifier, or a string expression that indicates the item's caption searched for.
Item An Item object that defines the menu item.

The Item property is the default property of the ExMenu ActiveX Control, so the following statements ExMenu1.Item(1234) and ExMenu1(1234) are equivalents. The Item property looks recursively for the Item that has the specified identifier or caption. Also, the ExMenu1.Item(1234) and  ExMenu1.Items.Find(1234)  are equivalents. The Item property looks for first item that has the given identifier or given caption. It is recommended to  associate unique identifiers for the items. Use the Debug property to display items identifiers.

The following VB sample changes the foreground color for the item with the identifier 50:

With ExMenu1.Item(50)
    .ForeColor = vbRed
End With

The following C++ sample changes the foreground color for the item with the identifier 50:

CItem item = m_menu.GetItem( COleVariant( long( 50 ) ) );
item.SetForeColor( RGB(255,0,0) );

The following VB.NET sample changes the foreground color for the item with the identifier 50:

With AxExMenu1.item(50)
    .ForeColor = ToUInt32(Color.Red)
End With

where the ToUInt32 function converts a Color expression to OLE_COLOR:

Shared Function ToUInt32(ByVal c As Color) As UInt32
    Dim i As Long
    i = c.R
    i = i + 256 * c.G
    i = i + 256 * 256 * c.B
    ToUInt32 = Convert.ToUInt32(i)
End Function

The following C# sample changes the foreground color for the item with the identifier 50:

EXMENULib.item item = axExMenu1[50];
item.ForeColor = ToUInt32(Color.Red);

where the ToUInt32 function converts a Color expression to OLE_COLOR:

private UInt32 ToUInt32(Color c)
{
	long i;
	i = c.R;
	i = i + 256 * c.G;
	i = i + 256 * 256 * c.B;
	return Convert.ToUInt32(i);
}

The following VFP sample changes the foreground color for the item with the identifier 50:

With thisform.ExMenu1.Item(50)
	.ForeColor = RGB(255,0,0)
EndWith