protected int GetImageIndex(Pic.DAL.SQLite.TreeNode tn) { if (tn.IsDocument) { Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext(); Pic.DAL.SQLite.Document doc = tn.Documents(db)[0]; string docTypeName = doc.DocumentType.Name.ToLower(); Dictionary<string, int> format2iconDictionnary = new Dictionary<string, int>() { {"parametric component" , 2}, {"treedim des" , 3}, {"autodesk dxf" , 4}, {"adobe acrobat" , 5}, {"adobe illustrator" , 8}, {"raster image" , 9}, {"ms word" , 10}, {"ms excel" , 11}, {"ms powerpoint" , 12}, {"open office write" , 13}, {"open office calc" , 14}, {"artioscad" , 15}, {"treedim des3" , 17} }; if (format2iconDictionnary.ContainsKey(docTypeName)) return format2iconDictionnary[docTypeName]; else return 0; } else { if (string.Equals(tn.Name, "Root", StringComparison.CurrentCultureIgnoreCase)) return 16; // Root else return 0; } }