/// <summary> /// Handles the Added event of the Paths control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MetroTrackerPathCollectionEventArgs"/> instance containing the event data.</param> private void Paths_Added(object sender, MetroTrackerPathCollectionEventArgs e) { if (e.Item != null) { ZeroitMetroTracker metroTracker = this; e.Item.PropertyChanged += new PropertyChangedEventHandler(metroTracker.Path_PropertyChanged); this._pens.Add(e.Item, new Pen(e.Item.LineColor, e.Item.LineWidth)); this._brushes.Add(e.Item, new SolidBrush(e.Item.FillColor)); this._nameBrushes.Add(e.Item, new SolidBrush(e.Item.LineColor)); } }
/// <summary> /// Handles the Removing event of the Paths control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MetroTrackerPathCollectionEventArgs"/> instance containing the event data.</param> private void Paths_Removing(object sender, MetroTrackerPathCollectionEventArgs e) { if (e.Item != null) { ZeroitMetroTracker metroTracker = this; e.Item.PropertyChanged -= new PropertyChangedEventHandler(metroTracker.Path_PropertyChanged); this._pens[e.Item].Dispose(); this._pens.Remove(e.Item); this._brushes[e.Item].Dispose(); this._brushes.Remove(e.Item); this._nameBrushes[e.Item].Dispose(); this._nameBrushes.Remove(e.Item); } }