private void DrawingCanvas_MouseMove(object sender, MouseEventArgs e) { if (floater != null) { // Update location of floating connector and redraw floater.OpenPoint = e.Location; floater.Refresh(); } Refresh(); }
public void SubsystemClicked(object sender, MouseEventArgs e) { try { SubsystemIcon icon = (SubsystemIcon)sender; if (floater != null) { // Connect other end if (floater.IndependentIcon == null) { floater.IndependentIcon = icon; } else { floater.DependentIcon = icon; } // Add to list and reset floater reference Connections.Add(floater); floater = null; RefreshConnections(); return; } if (icon.IsOverLeft) { // Create floating dependency from left side floater = new DependencyConnection(); floater.Parent = this; floater.Location = new Point(0, 0); floater.Height = Height; floater.Width = Width; floater.DependentIcon = icon; floater.OpenPoint = e.Location; floater.Refresh(); } if (icon.IsOverRight) { // Create floating (in)dependency from right side floater = new DependencyConnection(); floater.Parent = this; floater.Location = new Point(0, 0); floater.Height = Height; floater.Width = Width; floater.IndependentIcon = icon; floater.OpenPoint = e.Location; floater.Refresh(); } } catch (InvalidCastException) { // Subsystem click not sent by subsystem MessageBox.Show("Subsystem click not sent by subsystem"); } }