Returns or sets the foreground color of the file.
![]() | Type | Description | ||
| Color | A color expression that defines the file's foreground color. |
Use the BackColor and ForeColor properties to change the background and foreground colors for a specified file/folder. Use the Get method to get the collection of files/folders. Use the Folder property to specify whether the File object hosts a file or a folder. Use the SelForeColor property to specify the foreground color for selected items.

The following VB sample changes the foreground color for the item named "Temp":
With ExFileView1.Get(AllItems)("Temp")
.BackColor = vbBlue
.ForeColor = vbYellow
.Bold = True
End With
The BackColor attribute is lost if the control is refreshed or if the Apply property is called. For instance, If you need a permanent foreground color for specified folders, you can add a new FileType object like in the following VB sample:
With ExFileView1.FileTypes.Add("Temp")
.Folder = True
.BackColor = vbBlue
.ForeColor = vbYellow
.Bold = True
.Apply
End With
The following C++ sample changes the foreground color for the item named "Temp":
CFile1 file = m_fileview.GetGet( 1 /*AllItems*/ ).GetItem( COleVariant( "Temp" ) ); file.SetBackColor( RGB(0,0,255) ); file.SetForeColor( RGB(255,255,255) ); file.SetBold( TRUE );
The BackColor attribute is lost if the control is refreshed or if the Apply property is called. For instance, If you need a permanent foreground color for specified folders, you can add a new FileType object like in the following C++ sample:
#include "FileType.h"
#include "FileTypes.h"
CFileType fileType = m_fileview.GetFileTypes().Add("Temp");
fileType.SetFolder( TRUE );
fileType.SetBold( TRUE );
fileType.SetForeColor( RGB(255,255,255) );
fileType.SetBackColor( RGB(0,0,255) );
fileType.Apply();
The following VB.NET sample changes the foreground color for the item named "Temp":
With AxExFileView1.get_Get(EXFILEVIEWLib.TypeEnum.AllItems).Item("Temp")
.BackColor = ToUInt32(Color.Blue)
.ForeColor = ToUInt32(Color.Yellow)
.Bold = True
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 BackColor attribute is lost if the control is refreshed or if the Apply property is called. For instance, If you need a permanent foreground color for specified folders, you can add a new FileType object like in the following VB.NET sample:
With AxExFileView1.FileTypes.Add("Temp")
.Folder = True
.BackColor = ToUInt32(Color.Blue)
.ForeColor = ToUInt32(Color.Yellow)
.Bold = True
.Apply()
End With
The following C# sample changes the foreground color for the item named "Temp":
EXFILEVIEWLib.File file = axExFileView1.get_Get(EXFILEVIEWLib.TypeEnum.AllItems)["Temp"]; file.BackColor = ToUInt32(Color.Blue); file.ForeColor = ToUInt32(Color.Yellow); file.Bold = true;
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 BackColor attribute is lost if the control is refreshed or if the Apply property is called. For instance, If you need a permanent foreground color for specified folders, you can add a new FileType object like in the following C# sample:
EXFILEVIEWLib.FileType fileType = axExFileView1.FileTypes.Add("Temp");
fileType.Folder = true;
fileType.BackColor = ToUInt32(Color.Blue);
fileType.ForeColor = ToUInt32(Color.Yellow);
fileType.Bold = true;
fileType.Apply();
The following VFP sample changes the foreground color for the item named "Temp":
With thisform.ExFileView1.Get(1).Item("Temp") && AllItems
.BackColor = RGB(0,0,255)
.ForeColor = RGB(255,255,255)
.Bold = .t.
EndWith
The BackColor attribute is lost if the control is refreshed or if the Apply property is called. For instance, If you need a permanent foreground color for specified folders, you can add a new FileType object like in the following VFP sample:
With thisform.ExFileView1.FileTypes.Add("Temp")
.Folder = .t.
.BackColor = RGB(0,0,255)
.ForeColor = RGB(255,255,255)
.Bold = .t.
.Apply()
EndWith