private void listControl_MouseMove(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left || !this.listItemClicked) { return; } if (!this.dragging && ExprEditorDragDropManager.IsRealDragging(e.Location, this.downPt)) { RadElement elementAtPoint = this.treeControl.ElementTree.GetElementAtPoint(e.Location); TreeNodeElement treeNodeElement = elementAtPoint as TreeNodeElement; if (treeNodeElement == null && elementAtPoint != null) { treeNodeElement = elementAtPoint.FindDescendant <TreeNodeElement>(); } if (treeNodeElement == null) { return; } this.treeControl.SelectedNode = treeNodeElement.Data; this.dragging = true; this.treeControl.Capture = true; this.treeControl.FindForm().Cursor = Cursors.No; this.outlineForm = TelerikHelper.CreateOutlineForm(); this.outlineForm.ShowInTaskbar = false; this.outlineForm.ShowIcon = false; this.outlineForm.BackgroundImage = (Image)treeNodeElement.GetAsBitmap(Brushes.Transparent, 0.0f, new SizeF(1f, 1f)); this.outlineForm.FormBorderStyle = FormBorderStyle.None; this.outlineForm.Size = this.outlineForm.BackgroundImage.Size; this.outlineForm.MinimumSize = this.outlineForm.BackgroundImage.Size; this.outlineForm.Location = new Point(Cursor.Position.X + 2, Cursor.Position.Y + 2); this.outlineForm.TopMost = true; this.outlineForm.Show(); } else { if (!this.dragging) { return; } Point mousePosition = Control.MousePosition; Point client = this.treeControl.FindForm().PointToClient(mousePosition); this.outlineForm.Location = new Point(mousePosition.X + 5, mousePosition.Y + 5); if (this.textBox.Bounds.Contains(client)) { this.treeControl.FindForm().Cursor = Cursors.Arrow; } else { this.treeControl.FindForm().Cursor = Cursors.No; } } }
private void listControl_MouseDown(object sender, MouseEventArgs e) { this.downPt = e.Location; this.listItemClicked = false; RadElement elementAtPoint = this.treeControl.ElementTree.GetElementAtPoint(e.Location); TreeNodeElement treeNodeElement = elementAtPoint as TreeNodeElement; if (treeNodeElement == null && elementAtPoint != null) { treeNodeElement = elementAtPoint.FindDescendant <TreeNodeElement>(); } if (treeNodeElement == null) { return; } this.listItemClicked = true; }