private void OnDragDrop(object sender, DragEventArgs e) { if (connection != null) { RemoveConnection(); } Form form = FindForm(); connection = (OutLabel)e.Data.GetData(typeof(OutLabel)); connection.AddConnection(this); DragDot dh = connection.DragHandle; this.line = new ConnectionLine(); this.line.End = form.PointToClient(PointToScreen(DragHandle.Center)); this.line.Start = form.PointToClient(connection.PointToScreen(dh.Center)); form.Controls.Add(line); form.Invalidate(); }
protected void OnMouseClick(object sender, MouseEventArgs e) { dragLine = new ConnectionLine(); dragLine.Start = FindForm().PointToClient(PointToScreen(DragHandle.Center)); dragLine.End = PointToClient(e.Location); FindForm().Controls.Add(dragLine); dragLine.Invalidate(); DragDropEffects effect = dragDot.DoDragDrop(this, DragDropEffects.Link); FindForm().Controls.Remove(dragLine); dragLine = null; DragHandle.Glowing = false; }