/// <summary> /// Event handler for the 'Shown' event. Called every time the form is shown, similar to the 'Activated' event, however, unlike the /// 'Activated' event, the dimensions of the form will now be valid making this method more useful for positioning components. /// </summary> /// <param name="sender">Reference to the object that raised the event.</param> /// <param name="e">Parameter passed from the object that raised the event.</param> protected virtual void FormDataStreamPlot_Shown(object sender, EventArgs e) { // Skip, if the Dispose() method has been called. if (IsDisposed) { return; } Update(); // Ensure that an exception isn't thrown when a child form is opened in the Visual Studio development environment. if (MainWindow == null) { return; } Cursor = Cursors.WaitCursor; // --------------------------------------------- // Configure the plotter user controls. // --------------------------------------------- Debug.Assert(MainWindow != null); MainWindow.WriteStatusMessage(Resources.SMConfiguringPlotterControls); ModifyPlotterWatch setRange = new ModifyPlotterWatch(m_PlotterControlLayout.SetRangeProperties); ModifyPlotterWatch setAesthetics = new ModifyPlotterWatch(m_PlotterControlLayout.SetAestheticProperties); // Set the range parameters. CallFunction(m_TabControl, setRange, null); #region - [UserControlSize_t Definitions] - Debug.Assert(MainWindow != null); // The margins are the same for all plotter controls, however, the height varies for each control type. UserControlSize_t plotterScalarSize = new UserControlSize_t(); plotterScalarSize.Margin.Left = PlotterControlLayout.MarginLeftUserControl; plotterScalarSize.Margin.Right = PlotterControlLayout.MarginRightUserControl; plotterScalarSize.Margin.Top = PlotterControlLayout.MarginTopUserControl; plotterScalarSize.Margin.Bottom = PlotterControlLayout.MarginBottomUserControl; plotterScalarSize.Size = new Size(MainWindow.DisplayRectangle.Width - plotterScalarSize.Margin.Horizontal, PlotterControlLayout.HeightPlotterControl); UserControlSize_t plotterEnumeratorSize; plotterEnumeratorSize = plotterScalarSize; plotterEnumeratorSize.Size = new Size(MainWindow.DisplayRectangle.Width - plotterEnumeratorSize.Margin.Horizontal, PlotterControlLayout.HeightEnumeratorPlotterControl); UserControlSize_t plotterBitmaskSize; plotterBitmaskSize = plotterScalarSize; plotterBitmaskSize.Size = new Size(MainWindow.DisplayRectangle.Width - plotterBitmaskSize.Margin.Horizontal, PlotterControlLayout.HeightLogicAnalyzerControl); #endregion - [UserControlSize_t Definitions] - // Set the size, font and background color. CallFunction(m_TabControl, setAesthetics, new object[] { plotterScalarSize.Size, plotterEnumeratorSize.Size, plotterBitmaskSize.Size, Parameter.Font, Color.White }); // Set the trip time, if appropriate. SetTripTime(m_TabControl, PlotterRangeSelection.TripTime); LayoutPanelsVisible(m_TabControl, true); // --------------------------------------------- // Plot the historic data. // --------------------------------------------- MainWindow.WriteStatusMessage(Resources.SMPlottingData); PlotHistoricData(m_TabControl); if (m_IsDefaultLayout == true) { MainWindow.WriteStatusMessage(string.Empty); } else { MainWindow.WriteStatusMessage(Resources.SMModifiedPlotLayout, Color.White, Color.Red); } // Write the car identifier associated with the data stream. MainWindow.WriteCarIdentifier(WatchFile.Header.TargetConfiguration.CarIdentifier); Cursor = Cursors.Default; }
/// <summary> /// Calls the specified delegated function for each row of the <c>TableLayoutPanel</c> control associated with each <c>TabPage</c> of the /// specified <c>TabControl</c>. /// </summary> /// <param name="tabControl">The <c>TabControl</c> that is to be processed.</param> /// <param name="functionDelegate">The delegate for the function that is to be called.</param> /// <param name="parameter">The parameters, as an object array, that are to be passsed to the delegate.</param> private void CallFunction(TabControl tabControl, ModifyPlotterWatch functionDelegate, object parameter) { // Reference to the TableLayoutPanel associated with each TabPage. TableLayoutPanel tableLayoutPanel; for (int index = 0; index < tabControl.TabPages.Count; index++) { tableLayoutPanel = tabControl.TabPages[index].Controls[KeyTableLayoutPanel] as TableLayoutPanel; if (tableLayoutPanel == null) { continue; } for (int rowIndex = 0; rowIndex < tableLayoutPanel.Controls.Count; rowIndex++) { functionDelegate(tableLayoutPanel.Controls[rowIndex] as IPlotterWatch, parameter); } } }