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?

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.