Nbtexplorer modify statistics3/16/2023 GroupBox_Explorer.A mod that allows you to modify the NBT-data of entities and TileEntities while you are playing. GroupBox_Explorer.Size = new ( 281, 322) GroupBox_Explorer.Name = " groupBox_Explorer" GroupBox_Explorer.MaximumSize = new ( 281, 322) GroupBox_Explorer.Location = new ( 3, 5) This.explorerTreeView1 = new WilsonProgramming.ExplorerTreeView() Private WilsonProgramming.ExplorerTreeView explorerTreeView1 MessageBox.Show("physicalPath : " + physicalPath) Void treeExplorer_SelectedIndexChanged(string physicalPath) += new WilsonProgramming.SelectedIndexChangedEventHandler(treeExplorer_SelectedIndexChanged) ShellItem shNodeItem = (ShellItem)e.Node.Tag automatically selected during the initialization of This prevents the first node from expanding when it is Confirm that the user initiated the selection. Protected override void OnAfterSelect(TreeViewEventArgs e) ShellItem shNode = (ShellItem)e.Node.Tag ĪrrayList arrSub = shNode.GetSubFolders() We stored the ShellItem object in the node's Tag property - hah! Protected override void OnBeforeExpand(TreeViewCancelEventArgs e) StrPhysicalPath = treeWnd.strPhysicalPath If (shChild.IsFolder & shChild.HasSubFolder) If this is a folder item and has children then add a place holder node. TvwChild.SelectedImageIndex = shChild.IconIndex Now we need to add any children to the root node.ĪrrayList arrChildren = m_shDesktop.GetSubFolders() įoreach (ShellItem shChild in arrChildren) TvwRoot.SelectedImageIndex = m_shDesktop.IconIndex TvwRoot.ImageIndex = m_shDesktop.IconIndex Void treeWnd_SelectedIndexChanged(string physicalPath) TreeWnd.SelectedIndexChanged += new SelectedIndexChangedEventHandler(treeWnd_SelectedIndexChanged) Point the reference to the SelectedIndexChangedEventHandler method SystemImageList.SetTVImageList(treeWnd.Handle) Set the TreeView image list to the system image list. Private void OnSelectedIndexChanged(string strPhysicalPath) Public event SelectedIndexChangedEventHandler SelectedIndexChanged Public partial class ExplorerTreeView : UserControl Public delegate void SelectedIndexChangedEventHandler(string physicalPath) For example, in the TreeView's " OnBeforeCollapse" event, we can obtain the ShellItem object to perform a simple test. The ShellItem object allows you to retrieve information for the shell folder represented by the node, such as whether the folder has any sub-folders. Helpful Hintsįor each node in the TreeView, an associated ShellItem object is created and stored in the node's " Tag" property. All of the code was written by myself but some of the concepts were "borrowed". Parts of the code are based on other CodeProject tutorials and code samples found elsewhere on the Internet. Thanks to CodeProject and other code repositories, I came across some good examples of how to achieve what I wanted, however the best examples were written in VB.NET or Delphi, so I decided to write a simple C# control based on what I'd found. Originally, I started researching this topic as I wanted to develop an FTP client in C# that would implement a local system explorer similar to that of the Windows Explorer, but it soon became apparent that it was not going to be an easy undertaking. It provides no added functionality aside from the standard TreeView control methods, properties, and events, however it does provide a ShellItem class, which can be used to extend this basic example for your own needs, and it is also a good starting point for those wanting to get to grips with the system image list and Shell32 programming. This is a simple TreeView derived control that mimics the Windows Explorer interface.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |