private void treeView1_AfterSelect(object sender, Forms::TreeViewEventArgs e) { Module module = e.Node.Tag as Module; if (module != null) { this.propertyGrid1.SelectedObject = module; return; } ImageImportDirectory import = e.Node.Tag as ImageImportDirectory; if (import != null) { this.propertyGrid1.SelectedObject = import; return; } ImageImportDirectory.ImportModule imod = e.Node.Tag as ImageImportDirectory.ImportModule; if (imod != null) { this.propertyGrid1.SelectedObject = imod; return; } }
private void treeView1_BeforeExpand(object sender, Forms::TreeViewCancelEventArgs e) { Module module = e.Node.Tag as Module; if (module != null) { if (e.Node.Nodes.Count > 0 && e.Node.Nodes[0].Text != BEFORE_EXPAND) { return; } e.Node.Nodes.Clear(); ImageImportDirectory itable = (ImageImportDirectory)module.Directories[mwg.Win32.IMAGE.DIRECTORY_ENTRY.IMPORT]; Forms::TreeNode node = new Forms::TreeNode("ImportTable"); node.Tag = itable; node.Nodes.Add(BEFORE_EXPAND); e.Node.Nodes.Add(node); return; } ImageImportDirectory import = e.Node.Tag as ImageImportDirectory; if (import != null) { if (e.Node.Nodes.Count > 0 && e.Node.Nodes[0].Text != BEFORE_EXPAND) { return; } e.Node.Nodes.Clear(); foreach (ImageImportDirectory.ImportModule imod in import) { Forms::TreeNode child = new Forms::TreeNode(imod.Name); child.Tag = imod; e.Node.Nodes.Add(child); } return; } }