1,105,402 Community Members

How to show icons (or thumbnails) in a treeview?

Member Avatar
staticclass
Newbie Poster
9 posts since Feb 2011
Reputation Points: -2 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi, I have an application with a treeview, with each node(child) linked to a file. I can read the file name and extension, and I want to put icons to the left of the treeview nodes. (see the picture)

For example, if the file is .xls, I will put an excel icon, etc.

I know I can do this by creating pictureboxes dynamically, but how can I adjust the lines? Because the application will be run in a lot of different computers which have different screen resolutions.

e.g. Can I get directly the pixel size of a treeview line?

Member Avatar
zachattack05
Posting Pro
592 posts since Dec 2009
Reputation Points: 56 [?]
Q&As Helped to Solve: 16 [?]
Skill Endorsements: 0 [?]
 
0
 

Hmmm...tree views can have an image list associated with them. You might want to check that out instead, then you don't have to worry about pictureboxes.

Also, another consideration. The Microsoft Office icons are copyrighted and probably trademarked. I would be careful about including the icons in your application, but instead draw up the default icon for that particular file type on the computer your application is running on. Some users (like me) don't have MS Office at home, but use Open Office instead and the icons are different. Unless someone is familiar with the MS Office icons, they really lose their meaning.

EDIT: While it is true that Open Office has different file extensions, Open Office CAN open .xls files and they do not have the same icon at my house as they do here at work where MS Office is installed. Just a FYI :)

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: