method FileTypes.Add (Pattern as String)

Adds a FileType object to the collection and returns a reference to the newly created object.

TypeDescription
Pattern as String A string expression that may include wild cards like * or ?.
ReturnDescription
FileTypeA FileType object that has been created.

Use the Add property to change the appearance for specified files or folders. Use the FileTypes property to access the FileType objects collection. The new appearance is applied even if the user changes the browsed folder. The BrowseFolderPath property specifies the path to the browsed folder. Use the Apply method to apply all changes to the current list, else they will take effect as soon as the user browses a new folder.

The following VB sample changes the background color for the exe files:

With ExFileView1.FileTypes
    .Add("*.exe").BackColor = vbRed
    .Apply
End With

The following C++ sample changes the background color for the exe files:

#include "FileType.h"
#include "FileTypes.h"
CFileType fileType = m_fileview.GetFileTypes().Add("*.exe");
fileType.SetBackColor( RGB(255,0,0) );
fileType.Apply();

The following VB.NET sample changes the background color for the exe files:

With AxExFileView1.FileTypes.Add("*.exe")
    .BackColor = ToUInt32(Color.Red)
    .Apply()
End With

where the ToUInt32 function converts a Color expression to OLE_COLOR type,

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 background color for the exe files:

EXFILEVIEWLib.FileType fileType = axExFileView1.FileTypes.Add("*.exe");
fileType.BackColor = ToUInt32(Color.Red);
fileType.Apply();

where the ToUInt32 function converts a Color expression to OLE_COLOR type,

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 background color for the exe files:

With thisform.ExFileView1.Add("*.exe")
	.BackColor = RGB(255,0,0)
	.Apply()
EndWith