protected override void OnAfterSelect(TreeViewEventArgs e) { ResourceTreeNode selected = e.Node as ResourceTreeNode; if (selected != null) { if (selected.CommandType != ResourceType.None) { if (Focused) { resourceListBox.ShowNode(selected.CommandType); } selected.Expand(); } else { if (Focused) { resourceListBox.ShowNode(selected.Text, selected.ResourceType); } } } base.OnAfterSelect(e); }
private ResourceTreeNode GetNode(string name, ResourceTreeNode node) { foreach (ResourceTreeNode rnode in node.Nodes) { if (name == rnode.Text) { return(rnode); } } return(null); }
public void RemoveResource(IResource resource) { BeginUpdate(); foreach (ResourceTreeNode pnode in Nodes) { ResourceTreeNode to_delete = GetNode(resource.ResourceName, pnode); if (to_delete != null) { pnode.Nodes.Remove(to_delete); break; } } EndUpdate(); }
public void ShowItem(IResource iResource, ResourceType showType) { ResourceTreeNode to_select = null; switch (showType) { case ResourceType.TypeImage: to_select = GetNode(iResource.ResourceName, image); break; case ResourceType.TypeString: to_select = GetNode(iResource.ResourceName, tstring); break; case ResourceType.TypeIcon: to_select = GetNode(iResource.ResourceName, icon); break; case ResourceType.TypeColor: to_select = GetNode(iResource.ResourceName, color); break; case ResourceType.TypeCursor: to_select = GetNode(iResource.ResourceName, cursor); break; case ResourceType.TypeByteArray: to_select = GetNode(iResource.ResourceName, bytearray); break; default: break; } if (to_select != null) { BeginUpdate(); CollapseAll(); to_select.EnsureVisible(); SelectedNode = to_select; EndUpdate(); } }
private ResourceTreeNode GetNode(string name, ResourceTreeNode node) { foreach (ResourceTreeNode rnode in node.Nodes) if (name == rnode.Text) return rnode; return null; }