/// <summary> /// The DisplayNewMonitor method. /// </summary> /// <param name="monitor">The monitor to display.</param> /// <param name="location">The location of the new monitor.</param> public void DisplayNewMonitor(Monitor monitor, Point location) { var newPosition = new MonitorPosition { MonitorId = monitor.Id, Position = new Rect { Left = location.X, Top = location.Y, Height = 60, Width = 80 } }; CurrentMonitorPositions.Add(newPosition); var monitorPanel = new MonitorPanel { Tag = newPosition, Location = new Point(location.X, location.Y), Size = new Size(80, 60), BorderStyle = BorderStyle.FixedSingle }; AddMonitorPanel(monitorPanel, monitor.Name); }
/// <summary> /// The ItemRemoveMonitor_Click method. /// </summary> /// <param name="sender">The <paramref name="sender"/> parameter.</param> /// <param name="args">The <paramref name="args"/> parameter.</param> private void ItemRemoveMonitor_Click(object sender, EventArgs args) { var toolStripItem = (ToolStripItem)sender; var monitorPanel = toolStripItem.Tag as MonitorPanel; if (monitorPanel == null) { return; } var monitorPosition = (MonitorPosition)monitorPanel.Tag; if (monitorPosition != null) { CurrentMonitorPositions.Remove(monitorPosition); } monitorPanel.Dispose(); Refresh(); }