private void ReprecateMenuToTree(TreeNodeCollection collection, CustomToolStripMenuItem menu) { if (menu.IsFolder) { var treeNode = new CustomTreeNode(menu.CustomToolTipText, menu.Text); this.AddFolder(collection, treeNode); foreach (CustomToolStripMenuItem childMenu in menu.DropDownItems) { ReprecateMenuToTree(treeNode.Nodes, childMenu); } } else { var treeNode = new CustomTreeNode(menu.Dumper, menu.Text); this.AddFlow(collection, treeNode); if (menu.DropDownItems.Count > 0) { foreach (CustomToolStripMenuItem childMenu in menu.DropDownItems) { var childNode = new CustomTreeNode(childMenu.Dumper, childMenu.Text); this.AddFlow(treeNode.Nodes, childNode); } } } }
private void AddFolder(TreeNodeCollection collection, CustomTreeNode node) { node.Name = node.Text; node.ImageKey = folderKey; node.SelectedImageKey = folderKey; collection.Add(node); }
private void AddFlow(TreeNodeCollection collection, CustomTreeNode node) { node.Name = node.Text; node.ImageKey = flowSourceKey; node.SelectedImageKey = flowSourceKey; collection.Add(node); }
public override object Clone() { CustomTreeNode ret = Dumper == null ? new CustomTreeNode(CustomToolTipText, Text) : new CustomTreeNode(Dumper, Text); ret.Name = Name; return(ret); }
protected CustomTreeNode(SerializationInfo info, StreamingContext context) { var address = (IntPtr)info.GetValue("dataAddress", typeof(IntPtr)); var handle = GCHandle.FromIntPtr(address); Data = (CustomTreeNode)handle.Target; handle.Free(); }
private bool IsFilteredNode(CustomTreeNode node, NodeFilterInfoBase filter) { if (node.Dumper == null) { return(true); } return(!filter.IsHide(node.Dumper)); }
void areaControl_Drop(object sender, System.Windows.DragEventArgs e) { if (e.Data.GetDataPresent(typeof(CustomTreeNode)) && !(e.Data.GetData(typeof(CustomTreeNode)) as CustomTreeNode).Data.IsFolder) { CustomTreeNode treeNode = (e.Data.GetData(typeof(CustomTreeNode)) as CustomTreeNode).Data; var p = e.GetPosition(areaControl); AddSource(treeNode.Dumper, p.X, p.Y); } }
private void treeView1_MouseMove(object sender, MouseEventArgs e) { var node = treeView1.GetNodeAt(new Point(e.X, e.Y)) as CustomTreeNode; if (node != lastHoverNode) { HideToolTip(); timer.Stop(); timer.Start(); lastHoverNode = node; } }
private bool IsFilteredNode(CustomTreeNode node, string filter) { if (node.Text.ToLower().Contains(filter)) { return(true); } var customTreeNode = node as CustomTreeNode; if (customTreeNode == null || customTreeNode.Dumper == null) { return(false); } foreach (var item in customTreeNode.Dumper.InEvents.Concat(customTreeNode.Dumper.OutEvents).Concat( customTreeNode.Dumper.InProperties).Concat(customTreeNode.Dumper.OutProperties)) { if (item.Name.ToLower().Contains(filter)) { return(true); } } return(false); }