/// <summary> /// Configure the watch user controls required to display the specified <paramref name="workset"/> and then add these to the specified /// <paramref name="displayPanel"/>. /// </summary> /// <param name="workset">The workset that is to be used to configure the watch user controls.</param> /// <param name="displayPanel">The <c>Panel</c> to which the configured watch user controls are to be added.</param> /// <param name="watchControlSize">The size to make each watch user control.</param> /// <remarks>This method uses the <c>UserControl</c> class to: (a) layout and initialize all of the controls required to display the watch variables /// associated with the specified worset and (b) add these to the tabpage/panel associated with the display. /// </remarks> protected void ConfigureDisplayPanel(Workset_t workset, Panel displayPanel, VariableControlSize_t watchControlSize) { // Skip, if the Dispose() method has been called. if (IsDisposed) { return; } // Clear the panel to which the controls are to be added. displayPanel.Hide(); displayPanel.Controls.Clear(); // Instantiate the watch control jagged array. m_WatchControls = new WatchControl[workset.Column.Length][]; for (int columnIndex = 0; columnIndex < workset.Column.Length; columnIndex++) { m_WatchControls[columnIndex] = new WatchControl[workset.Column[columnIndex].OldIdentifierList.Count]; } // Create a separate panel for each display column. Panel[] panelColumn = new Panel[workset.Column.Length]; for (int columnIndex = 0; columnIndex < workset.Column.Length; columnIndex++) { panelColumn[columnIndex] = new Panel(); panelColumn[columnIndex].AutoSize = true; panelColumn[columnIndex].Location = new Point(columnIndex * (watchControlSize.Size.Width + watchControlSize.Margin.Horizontal), 0); m_WatchControlLayout.WriteColumnHeaders(workset.Column[columnIndex].HeaderText, panelColumn[columnIndex], watchControlSize); m_WatchControlLayout.ConfigureWatchControls(m_WatchControls[columnIndex], panelColumn[columnIndex], watchControlSize, workset.Column[columnIndex].OldIdentifierList); displayPanel.Controls.Add(panelColumn[columnIndex]); } displayPanel.Show(); }
/// <summary> /// Configure the watch user controls required to display the specified <paramref name="workset"/> and then add these to the specified /// <paramref name="displayPanel"/>. /// </summary> /// <param name="workset">The workset that is to be used to configure the watch user controls.</param> /// <param name="displayPanel">The <c>Panel</c> to which the configured watch user controls are to be added.</param> /// <param name="watchControlSize">The size to make each watch user control.</param> /// <remarks>This method uses the <c>UserControl</c> class to: (a) layout and initialize all of the controls required to display the watch variables /// associated with the specified worset and (b) add these to the tabpage/panel associated with the display. /// </remarks> protected void ConfigureDisplayPanel(Workset_t workset, Panel displayPanel, VariableControlSize_t watchControlSize) { // Skip, if the Dispose() method has been called. if (IsDisposed) { return; } // Clear the panel to which the controls are to be added. displayPanel.Hide(); displayPanel.Controls.Clear(); // Instantiate the watch control jagged array. m_WatchControls = new WatchControl[workset.Column.Length][]; for (int columnIndex = 0; columnIndex < workset.Column.Length; columnIndex++) { m_WatchControls[columnIndex] = new WatchControl[workset.Column[columnIndex].OldIdentifierList.Count]; } // Create a separate panel for each display column. Panel[] panelColumn = new Panel[workset.Column.Length]; for (int columnIndex = 0; columnIndex < workset.Column.Length; columnIndex++) { panelColumn[columnIndex] = new Panel(); panelColumn[columnIndex].AutoSize = true; panelColumn[columnIndex].Location = new Point(columnIndex * (watchControlSize.Size.Width + watchControlSize.Margin.Horizontal), 0); m_WatchControlLayout.WriteColumnHeaders(workset.Column[columnIndex].HeaderText, panelColumn[columnIndex], watchControlSize); m_WatchControlLayout.ConfigureWatchControls(m_WatchControls[columnIndex], panelColumn[columnIndex], watchControlSize, workset.Column[columnIndex].OldIdentifierList); // Do not add the panel to the controls associated with the 'displayPanel' parameter if the last column of the workset does not contain any watch // variables AND no header text is defined. This ensures that the horizontal scroll bar is not displayed. if ((columnIndex == workset.Column.Length - 1) && (workset.Column[columnIndex].OldIdentifierList.Count == 0) && (workset.Column[columnIndex].HeaderText.Equals(string.Empty))) { break; } else { displayPanel.Controls.Add(panelColumn[columnIndex]); } } displayPanel.Show(); }