/// <summary> /// Initializes a new instance of the <see cref="ZeroitMetroTracker" /> class. /// </summary> public ZeroitMetroTracker() { this._paths = new MetroTrackerPathCollection(); this._pens = new Dictionary <MetroTrackerPath, Pen>(); this._brushes = new Dictionary <MetroTrackerPath, Brush>(); this._nameBrushes = new Dictionary <MetroTrackerPath, Brush>(); this._BorderColor = Design.MetroColors.LightBorder; this._GridColor = Design.MetroColors.PopUpBorder; this._Style = Design.Style.Light; this._GridStyle = Design.GridStyle.Crossed; this._GridSize = 10; this._ShowPathNames = true; this._ShowCustomValue = true; this._ShowedValueCount = 1000; this._AutoStyle = true; this.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); this.UpdateStyles(); this.BackColor = Color.White; this._paths = new MetroTrackerPathCollection(); ZeroitMetroTracker metroTracker = this; this.Paths.ItemAdded += new EventHandler <MetroTrackerPathCollectionEventArgs>(metroTracker.Paths_Added); ZeroitMetroTracker metroTracker1 = this; this.Paths.ItemRemoving += new EventHandler <MetroTrackerPathCollectionEventArgs>(metroTracker1.Paths_Removing); this._pens = new Dictionary <MetroTrackerPath, Pen>(); this._brushes = new Dictionary <MetroTrackerPath, Brush>(); this._nameBrushes = new Dictionary <MetroTrackerPath, Brush>(); }
/// <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); } }
/// <summary> /// Styles the special controls. /// </summary> /// <param name="ct">The ct.</param> private void StyleSpecialControls(Control ct) { IEnumerator enumerator = null; bool flag; try { try { enumerator = ct.Controls.GetEnumerator(); while (enumerator.MoveNext()) { Control current = (Control)enumerator.Current; if (current is ZeroitMetroListbox) { ZeroitMetroListbox style = (ZeroitMetroListbox)current; if (style.AutoStyle) { style.Style = this.Style; } style.Invalidate(); } else if (current is ZeroitMetroChecker) { ZeroitMetroChecker metroChecker = (ZeroitMetroChecker)current; if (metroChecker.AutoStyle) { metroChecker.Style = this.Style; } metroChecker.Invalidate(); } else if (!(current is ZeroitMetroTracker)) { if (!(current is TabPage) && !(current is Panel)) { if (current is ZeroitMetroPanelCategory) { goto Label1; } flag = false; goto Label0; } Label1: flag = true; Label0: if (flag) { this.StyleSpecialControls(current); } } else { ZeroitMetroTracker metroTracker = (ZeroitMetroTracker)current; if (metroTracker.AutoStyle) { metroTracker.Style = this.Style; } metroTracker.Invalidate(); } } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } } catch (Exception exception) { ProjectData.SetProjectError(exception); ProjectData.ClearProjectError(); } }