protected bool TreeNodeContains(TreeNode treeNode, IDataDefinitionExport obj) { IDataDefinitionExport tag = treeNode.Tag as IDataDefinitionExport; if (tag != null && tag.Equals(obj)) { return(true); } foreach (TreeNode node in treeNode.Nodes) { if (TreeNodeContains(node, obj)) { return(true); } } return(false); }
private void lbxExports_DragOver(object sender, DragEventArgs e) { IDataDefinitionExport draggedItem = e.Data.GetData(typeof(IDataDefinitionExportImpl)) as IDataDefinitionExport; if (draggedItem == null) { e.Effect = DragDropEffects.None; return; } foreach (IDataDefinitionExport lbi in lbxExports.Items) { if (draggedItem.Equals(lbi)) { e.Effect = DragDropEffects.None; return; } } e.Effect = DragDropEffects.Copy; }