We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,272 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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

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?

2
Contributors
1
Reply
8 Minutes
Discussion Span
1 Year Ago
Last Updated
2
Views
staticclass
Newbie Poster
9 posts since Feb 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 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 :)

zachattack05
Posting Pro
577 posts since Dec 2009
Reputation Points: 66
Solved Threads: 16
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0546 seconds using 2.67MB