title: Add Image to a TreeView loaded from a directory
body: <p>I have a <code>Treeview</code> that loads the Tree of a selected directory. Now I would like to make the directories have a folder image and the files a file image. Both Folder and File images are in a <code>imagelist</code> connected to my <code>treeview</code>. How would I adjust the following code to do this?</p>
  
  <pre><code>    private void ListDirectory(TreeView treeview, string path)
      {
          treeview.Nodes.Clear();
          var rootDirectoryInfo = new DirectoryInfo(path);
          treeview.Nodes.Add(CreateDirectoryNode(rootDirectoryInfo));
      }
  
  
      private static TreeNode CreateDirectoryNode(DirectoryInfo directoryInfo)
      {
          var directoryNode = new TreeNode(directoryInfo.Name);
  
          foreach (var directory in directoryInfo.GetDirectories())
          {
              directoryNode.Nodes.Add(CreateDirectoryNode(directory));
          }
  
  
          foreach (var file in directoryInfo.GetFiles())
          {
              directoryNode.Nodes.Add(new TreeNode(file.Name));
          }
          return directoryNode;
      }
  </code></pre>