![]() | Type | Description | ||
| Color | A color expression that specifies the item's foreground color when the UseForeColor property is True. |

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