private void OnPlotSelected(Plot2DGraph plotGraph) { if (PlotSelected != null) { PlotSelected(plotGraph); } }
private void UnselectAllPlots() { IDictionaryEnumerator en = this.hashtableGraphPlot.GetEnumerator(); while (en.MoveNext()) { Plot2DGraph p2dGraph = (Plot2DGraph)en.Key; p2dGraph.IsSelected = false; } this.plot2DControl.SetPlot2D(null); this.selectedP2D = null; this.selectedP2DGraph = null; }
private void AdjustGraphSize(Plot2DGraph p2dGraph, PlotGraphSize size) { if (size == PlotGraphSize.Medium) { p2dGraph.Width = (int)((p2dGraph.Width * 2) / 3); p2dGraph.Height = (int)((p2dGraph.Height * 2) / 3); } else if (size == PlotGraphSize.Small) { p2dGraph.Width = (int)(p2dGraph.Width / 2); p2dGraph.Height = (int)(p2dGraph.Height / 2); } }
public ViewPlot2DForm(ArrayList list, PlotGraphSize size) { // // Required for Windows Form Designer support // InitializeComponent(); int d = 4; int x = d; int y = 4; int i = 0; this.hashtableGraphPlot = new Hashtable(); IEnumerator en = list.GetEnumerator(); while (en.MoveNext()) { i++; Plot2D p2d = (Plot2D)en.Current; Plot2DGraph p2dGraph = new Plot2DGraph(); this.AdjustGraphSize(p2dGraph, size); AxisVariable avX = UI.ConvertToAxisVariable(p2d.PlotVariableX); AxisVariable avY = UI.ConvertToAxisVariable(p2d.PlotVariableY); PlotData pd = this.ConvertToPlotData(p2d); p2dGraph.UpdatePlot(pd, avX, avY); x = i * d + (i - 1) * p2dGraph.Width; p2dGraph.Location = new Point(x, y); this.panelPlots.Controls.Add(p2dGraph); this.hashtableGraphPlot.Add(p2dGraph, p2d); p2dGraph.PlotSelected += new PlotSelectedEventHandler(p2dGraph_PlotSelected); p2d.Plot2DChanged += new Plot2DChangedEventHandler(p2d_Plot2DChanged); } if (size == PlotGraphSize.Medium) { this.panelPlots.Height -= 135; this.Height -= 150; } else if (size == PlotGraphSize.Small) { this.panelPlots.Height -= 208; this.Height -= 222; } this.UnselectAllPlots(); this.plot2DControl.CheckBoxDetails.CheckedChanged += new EventHandler(CheckBoxDetails_CheckedChanged); }
private void p2dGraph_PlotSelected(Plot2DGraph plotGraph) { IDictionaryEnumerator en = this.hashtableGraphPlot.GetEnumerator(); while (en.MoveNext()) { Plot2DGraph p2dGraph = (Plot2DGraph)en.Key; if (p2dGraph != plotGraph) { p2dGraph.IsSelected = false; } } this.selectedP2DGraph = plotGraph; this.selectedP2D = (Plot2D)this.hashtableGraphPlot[plotGraph]; this.plot2DControl.SetPlot2D(this.selectedP2D); this.selectedP2DGraph.ShowDetails = this.plot2DControl.CheckBoxDetails.Checked; this.selectedP2DGraph.Invalidate(); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { IDictionaryEnumerator en = this.hashtableGraphPlot.GetEnumerator(); while (en.MoveNext()) { Plot2DGraph p2dGraph = (Plot2DGraph)en.Key; Plot2D p2d = (Plot2D)en.Value; p2dGraph.PlotSelected -= new PlotSelectedEventHandler(p2dGraph_PlotSelected); p2d.Plot2DChanged -= new Plot2DChangedEventHandler(p2d_Plot2DChanged); } if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); }