WinForms › Tree List View › SystemHelper
SystemHelper
class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.TreeControls
Reads icons and display names for files and folders from the Windows shell, so that rows in the tree list view can show the same icons Explorer does.
public class SystemHelper
Members at a glance
GetFileIcon | Returns the icon the shell shows for a file, optionally with the shortcut arrow over it. |
GetFolderIcon | Returns the generic folder icon the shell uses, without reference to any particular folder. |
GetFolderIcon | Returns the icon the shell shows for a particular folder, which lets a folder with its own icon keep it. |
Methods
GetFileIcon
public static System.Drawing.Icon GetFileIcon( string filePath, EnumIconSize size, bool addLinkOverlay)
Returns the icon the shell shows for a file, optionally with the shortcut arrow over it.
- filePath
- The file to get the icon for. It need not exist; the icon follows the extension.
- size
- Which icon size to fetch.
- addLinkOverlay
- true to overlay the shortcut arrow.
Returns. The icon. The caller owns it and should dispose it.
GetFolderIcon
public static System.Drawing.Icon GetFolderIcon( EnumIconSize size, EnumFolderType folderType)
Returns the generic folder icon the shell uses, without reference to any particular folder.
- size
- Which icon size to fetch.
- folderType
- The open or the closed variant.
Returns. The icon. The caller owns it and should dispose it.
GetFolderIcon
public static System.Drawing.Icon GetFolderIcon( string folderPath, EnumIconSize size, EnumFolderType folderType)
Returns the icon the shell shows for a particular folder, which lets a folder with its own icon keep it.
- folderPath
- The folder to get the icon for, or null for the generic folder icon.
- size
- Which icon size to fetch.
- folderType
- The open or the closed variant.
Returns. The icon. The caller owns it and should dispose it.