the program correctly displays only the names of folders that contain only ANSI characters, characters not included in the ANSI table of this operating system, are replaced by the characters ? in the program, I tried to set the CharSet = CharSet.Unicode parameter for the SHGetFileInfo function, but this does not affect the result.
Really great work! I compiled it on VS 2005.NET on Framework .NET 2.0 and executed it on Windows 2003 Server SE. It works perfectly, except that some of the icons appear with black background, for example DLL and TXT icons. I found some article describing how to convert some color to transparent color: http://ewbi.blogs.com/develops/2005/08/sparklines_22.html[^]
But it converts ALL the color pixels into transparent ones. Do you have any idea how can we get an icon from the OS with transparent background instead of black?
i have made some changes to use the treeview to open the selectedfile in to a axwebbrowser but not only the selected files opens into the browser olso the directory but that is not wat i want.(I use the selectedNode).
i want to load only the selected files (*.html or *.txt not the c:\\ ) not the directory in to the browser .
the next problem that comes up is when i use the open button to load another directory place in to the treeview then i can not use the selectednode or selectedfile for the webbrowser its not recognizing the path .
I whant to use webbrowser is to open the *.html documents becouse the richtextbox does not support images like *html.
how can i use the treeview to open files when i dubbelclick ont it
i realy want to use the tree without listview so to doe that i want to use a textbox or richtextbox to open the selected (node)file ..
i can't access the textbox from your class becouse iam a beginner.
sorry for my english.
Just what I was looking for, well more or less. I was looking for a file system browser and liked the idea that it loads nodes on demand to improve performance.
It was however missing something I also needed: to be able to select multiple nodes, not just one as in the standard tree view. Previous to this I had found a project that implemented just that. So I merged those changes into this project, added some extra comments, some design-time properties and now I could use it in solving my problem at hand.
I am trying to figure out how to best add a search filter to the tree. Should I modify the control or make changes to the tree after the fact. I have tried additional overloading methods with out much success.
Thanks so much for the article! I was trying to modify it to have it delete all directory node elemenst on each expand by iterating thru the nodes and removing them prior to population, but had many remained. I want to do this to capture any files added behing the scenes after expansion. I was using node.Nodes[i].remove, but it left namy nodes??
Can you offer a suggestion? Also, if anyone has extended this I would love to see the code.
How would you get files, with a folder to open in it's associated app when a file is double clicked? For instance, if you browse to folder c:\xyz which contains text files, how do you have them open in notepad?
Hi that kinda worked, but the directory would be moved, which is not so good. however i came up with another idea. and it works as long as there is less than 4 items in the destination node. Whenever the destination node contains 4 or more items, it crashes.. can you see why??
What it does is delete all the nodes in the destination node, and then load them again, to avoid duplicates of the items.
private void MoveFile(FileNode Node1, TreeNode Node2)
string strdir1 = Node1.Parent.FullPath; // get the path of the
string strdir2 = Node2.FullPath; // get the the drop target
strdir1 = strdir1 + "\\" + Node1.Text; // create file paths strdir2 = strdir2 + "\\" + Node1.Text;
Directory.Move(strdir1, strdir2); // use the
DirectoryNode dirnode = (DirectoryNode)Node2;
foreach(TreeNode node in dirnode.Nodes)