This documentation is archived and is not being maintained.

Foreground Property

Visual Studio .NET 2003

Sets or returns the foreground color of the item.

[Visual Basic .NET]
Public Property Foreground() As OLE_COLOR
[Visual Basic 6]
Property Get Foreground() As OLE_COLOR
Property Let Foreground( _
   ByVal NewValue As OLE_COLOR _
HRESULT __stdcall get_Foreground(
   /* [out, retval] */ OLE_COLOR* retVal
HRESULT __stdcall put_Foreground(
   /* [in] */ OLE_COLOR NewValue
public OLE_COLOR Foreground {get; set;}
[JScript .NET]
public function get Foreground() : OLE_COLOR
public function set Foreground(
   NewValue : OLE_COLOR


An OLE_COLOR object specifying the color of the item.

Return Value

Returns an OLE_COLOR object specifying the color of the item.


The following example lists the foreground, background, and bold values for the first colorable item.

Sub ForegroundExample()
   Dim props As EnvDTE.Properties
   props = DTE.Properties("FontsAndColors", "TextEditor")
   Dim prop As EnvDTE.Property = props.Item("FontsAndColorsItems")
   Dim clritems As EnvDTE.FontsAndColorsItems = prop.Object
   Dim clritem As EnvDTE.ColorableItems = clritems.Item(1)
   Dim ClrList As String

   ClrList += "Background color: " & clritem.Background.ToString & vbCr
   ClrList += "Foreground color: " & clritem.Foreground.ToString & vbCr
   ClrList += "Bold?: " & clritem.Bold.ToString
End Sub

See Also

Applies To: ColorableItems Object | FontsAndColorsItems Collection