public virtual void UpdateGrid() { try { // remove all existing rows gridSolutions.Rows.Clear(); // *** IViews // caption header SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.SteelBlue, Border = DevAge.Drawing.RectangleBorder.NoBorder }; captionHeader.Background = veHeaderCaption; captionHeader.ForeColor = Color.Black; captionHeader.Font = new Font("Arial", GridFontSize, FontStyle.Bold); captionHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; // viewRowHeader SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader backHeader = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }; viewRowHeader.Background = backHeader; viewRowHeader.ForeColor = Color.Black; viewRowHeader.Font = new Font("Arial", GridFontSize, FontStyle.Regular); // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** SourceGrid.Cells.RowHeader rowHeader; int iRow = -1; // loading caption gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(GridCaption) { ColumnSpan = 2, View = captionHeader }; gridSolutions[iRow, 0] = rowHeader; } catch (Exception ex) { _log.Error(ex.ToString()); } }
public override void FillGrid() { // clear grid gridSolutions.Rows.Clear(); // border gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 2; gridSolutions.FixedColumns = 1; // header SourceGrid.Cells.RowHeader rowHeader; SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader backHeader = new DevAge.Drawing.VisualElements.RowHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewRowHeader.Background = backHeader; viewRowHeader.ForeColor = Color.Black; viewRowHeader.Font = new Font("Arial", 10, FontStyle.Regular); int iRow = -1; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Layer #"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Interlayer #"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Case #"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; }
private void FillGrid() { try { // remove all existing rows gridSolutions.Rows.Clear(); // *** IViews // captionHeader SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader(); veHeaderCaption.BackColor = Color.SteelBlue; veHeaderCaption.Border = DevAge.Drawing.RectangleBorder.NoBorder; captionHeader.Background = veHeaderCaption; captionHeader.ForeColor = Color.Black; captionHeader.Font = new Font("Arial", GridFontSize, FontStyle.Bold); captionHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; // viewRowHeader SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.Black; viewColumnHeader.Font = new Font("Arial", GridFontSize, FontStyle.Regular); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** // set first row gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 7; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header int iCol = 0; SourceGrid.Cells.ColumnHeader columnHeader; // A1xA2xA3 columnHeader = new SourceGrid.Cells.ColumnHeader("A1 x A2 x A3"); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, iCol++] = columnHeader; // dimensions columnHeader = new SourceGrid.Cells.ColumnHeader( string.Format(Properties.Resources.ID_DIMENSIONS, UnitsManager.LengthUnitString)); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, iCol++] = columnHeader; // weight columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Properties.Resources.ID_WEIGHT_WU, UnitsManager.MassUnitString)); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, iCol++] = columnHeader; // #packs columnHeader = new SourceGrid.Cells.ColumnHeader("#"); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, iCol++] = columnHeader; // weight columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Properties.Resources.ID_PALLETWEIGHT, UnitsManager.MassUnitString)); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, iCol++] = columnHeader; // efficiency columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_EFFICIENCYPERCENTAGE); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, iCol++] = columnHeader; // maximum space columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Properties.Resources.ID_MAXIMUMSPACE, UnitsManager.LengthUnitString)); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, iCol++] = columnHeader; int iRow = 0; foreach (AnalysisHomo analysis in _analyses) { AnalysisCasePallet analysisCasePallet = analysis as AnalysisCasePallet; PackProperties pack = analysisCasePallet.Content as PackProperties; int layerCount = analysisCasePallet.Solution.Layers.Count; if (layerCount < 1) { continue; } int packPerLayerCount = analysisCasePallet.Solution.Layers[0].BoxCount; int itemCount = analysisCasePallet.Solution.ItemCount; double palletWeight = analysisCasePallet.Solution.Weight; double volumeEfficiency = analysisCasePallet.Solution.VolumeEfficiency; double maximumSpace = analysisCasePallet.Solution.LayerCount > 0 ? analysisCasePallet.Solution.LayerMaximumSpace(0) : 0; gridSolutions.Rows.Insert(++iRow); iCol = 0; gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format("{0} x {1} x {2}", pack.Arrangement.Length, pack.Arrangement.Width, pack.Arrangement.Height)); gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format("{0:0.#} x {1:0.#} x {2:0.#}", pack.OuterDimensions.X, pack.OuterDimensions.Y, pack.OuterDimensions.Z)); gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format("{0:0.###}", pack.Weight)); gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format("{0} = {1} x {2}", itemCount, packPerLayerCount, layerCount)); gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format("{0:0.###}", palletWeight)); gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format("{0:0.#}", volumeEfficiency)); gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format("{0:0.#}", maximumSpace)); } gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution if (gridSolutions.RowsCount > 1) { gridSolutions.Selection.SelectRow(1, true); } else { // grid empty -> clear drawing _selectedAnalysis = null; graphCtrlPack.Invalidate(); graphCtrlSolution.Invalidate(); } } catch (Exception ex) { _log.Error(ex.Message); } }
private void UpdateGrid() { try { // sanity check if (gridSolution.ColumnsCount < 2) { return; } // remove all existing rows gridSolution.Rows.Clear(); // *** IViews // captionHeader SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.SteelBlue, Border = DevAge.Drawing.RectangleBorder.NoBorder }; captionHeader.Background = veHeaderCaption; captionHeader.ForeColor = Color.Black; captionHeader.Font = new Font("Arial", GridFontSize, FontStyle.Bold); captionHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; // viewRowHeader SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader backHeader = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }; viewRowHeader.Background = backHeader; viewRowHeader.ForeColor = Color.Black; viewRowHeader.Font = new Font("Arial", GridFontSize, FontStyle.Regular); // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** SourceGrid.Cells.RowHeader rowHeader; int iRow = -1; // pallet caption gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Truck") { ColumnSpan = 2, View = captionHeader }; gridSolution[iRow, 0] = rowHeader; // layer # gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Layer #") { View = viewRowHeader }; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(_solution.LayerCount); // *** Item # (Recursive count) Packable content = _analysis.Content; int itemCount = _solution.ItemCount; int number = 1; do { itemCount *= number; gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format("{0} #", content.DetailedName)) { View = viewRowHeader }; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(itemCount); }while (null != content && content.InnerContent(ref content, ref number)); // *** // load dimensions BBox3D bboxLoad = _solution.BBoxLoad; // --- gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_LOADDIMENSIONS, UnitsManager.LengthUnitString)) { View = viewRowHeader }; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#} x {1:0.#} x {2:0.#}", bboxLoad.Length, bboxLoad.Width, bboxLoad.Height)); // net weight if (_solution.HasNetWeight) { gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_NETWEIGHT_WU, UnitsManager.MassUnitString)) { View = viewRowHeader }; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.NetWeight)); } // load weight gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_LOADWEIGHT_WU, UnitsManager.MassUnitString)) { View = viewRowHeader }; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.LoadWeight)); // total weight gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_TOTALWEIGHT_WU, UnitsManager.MassUnitString)) { View = viewRowHeader }; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.Weight)); // volume efficiency gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_VOLUMEEFFICIENCY) { View = viewRowHeader }; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.VolumeEfficiency)); // ### layers : begin for (int i = 0; i < _solution.Layers.Count; ++i) { } // ### layers : end gridSolution.AutoSizeCells(); gridSolution.Columns.StretchToFit(); gridSolution.AutoStretchColumnsToFitWidth = true; gridSolution.Invalidate(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void FillGrid() { // remove all existing rows gridSolutions.Rows.Clear(); // *** IViews // captionHeader SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.SteelBlue, Border = DevAge.Drawing.RectangleBorder.NoBorder }; captionHeader.Background = veHeaderCaption; captionHeader.ForeColor = Color.Black; captionHeader.Font = new Font("Arial", GridFontSize, FontStyle.Bold); captionHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; // viewRowHeader SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.Black; viewColumnHeader.Font = new Font("Arial", GridFontSize, FontStyle.Regular); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** // set first row gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 5; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header int iCol = 0; SourceGrid.Cells.ColumnHeader columnHeader; // name columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASENAME) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, iCol++] = columnHeader; // dimensions columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_DIMENSIONS, UnitsManager.LengthUnitString)) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, iCol++] = columnHeader; // #items columnHeader = new SourceGrid.Cells.ColumnHeader("#") { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, iCol++] = columnHeader; // efficiency columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_EFFICIENCYPERCENTAGE) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, iCol++] = columnHeader; // weight columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_WEIGHT_WU, UnitsManager.MassUnitString)) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, iCol++] = columnHeader; int iRow = 0; foreach (AnalysisHomo analysis in Analyses) { AnalysisBoxCase analysisBoxCase = analysis as AnalysisBoxCase; BoxProperties caseProperties = analysisBoxCase.CaseProperties; gridSolutions.Rows.Insert(++iRow); iCol = 0; gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(analysis.Container.ID.Name); gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format("{0} x {1} x {2} / {3} x {4} x {5}", caseProperties.Length, caseProperties.Width, caseProperties.Height, caseProperties.InsideLength, caseProperties.InsideWidth, caseProperties.InsideHeight)); gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(analysis.Solution.ItemCount); gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "{0:0.#}", analysis.Solution.VolumeEfficiency)); gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "{0:0.#}", analysis.Solution.Weight)); } gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution if (gridSolutions.RowsCount > 1) { gridSolutions.Selection.SelectRow(1, true); } else { // grid empty -> clear drawing graphCtrl.Invalidate(); } }
private void InitializeGrid() { // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.Black; viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // row header view SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader backRowHeader = new DevAge.Drawing.VisualElements.RowHeader(); backRowHeader.BackColor = Color.LightGray; backRowHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewRowHeader.Background = backRowHeader; viewRowHeader.ForeColor = Color.Black; // create the grid gridDynamicBCT.BorderStyle = BorderStyle.FixedSingle; gridDynamicBCT.ColumnsCount = McKeeFormula.HumidityCoefDictionary.Count + 1; gridDynamicBCT.RowsCount = McKeeFormula.StockCoefDictionary.Count + 1; // column header SourceGrid.Cells.ColumnHeader columnHeader; int indexCol = 0; columnHeader = new SourceGrid.Cells.ColumnHeader("Humidity (%)/Storage"); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridDynamicBCT[0, indexCol++] = columnHeader; foreach (string key in McKeeFormula.HumidityCoefDictionary.Keys) { columnHeader = new SourceGrid.Cells.ColumnHeader(key); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridDynamicBCT[0, indexCol++] = columnHeader; } SourceGrid.Cells.RowHeader rowHeader; int indexRow = 1; foreach (string key in McKeeFormula.StockCoefDictionary.Keys) { rowHeader = new SourceGrid.Cells.RowHeader(key); rowHeader.View = viewRowHeader; gridDynamicBCT[indexRow++, 0] = rowHeader; } gridDynamicBCT.AutoStretchColumnsToFitWidth = true; gridDynamicBCT.AutoSizeCells(); gridDynamicBCT.Columns.StretchToFit(); }
private void FillGrid() { try { // clear grid gridProfile.Rows.Clear(); // border gridProfile.BorderStyle = BorderStyle.FixedSingle; gridProfile.SelectionMode = GridSelectionMode.Row; gridProfile.ColumnsCount = 3; // *** IViews // caption header DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.SteelBlue, Border = DevAge.Drawing.RectangleBorder.NoBorder }; SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader { Background = veHeaderCaption, ForeColor = Color.Black, Font = new Font("Arial", GridFontSize + 2, FontStyle.Bold), TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter }; // viewRowHeader DevAge.Drawing.VisualElements.RowHeader backHeader = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }; SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader { Background = backHeader, ForeColor = Color.Black, Font = new Font("Arial", GridFontSize, FontStyle.Regular) }; // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** int iRow = -1; // ### sol items : begin gridProfile.Rows.Insert(++iRow); gridProfile[iRow, 1] = new SourceGrid.Cells.RowHeader($"{Resources.ID_HEIGHT} ({UnitsManager.LengthUnitString})") { View = captionHeader }; gridProfile[iRow, 2] = new SourceGrid.Cells.RowHeader($"{Resources.ID_DIAMETER} ({UnitsManager.LengthUnitString})") { View = captionHeader }; decimal inc = 0.0m; int noDecimalPlaces = 0; switch (UnitsManager.CurrentUnitSystem) { case UnitsManager.UnitSystem.UNIT_METRIC1: inc = 1.0m; noDecimalPlaces = 0; break; case UnitsManager.UnitSystem.UNIT_METRIC2: inc = 0.1m; noDecimalPlaces = 1; break; case UnitsManager.UnitSystem.UNIT_IMPERIAL: case UnitsManager.UnitSystem.UNIT_US: inc = 1.0m / 16.0m; noDecimalPlaces = 2; break; default: break; } foreach (var item in Profile) { gridProfile.Rows.Insert(++iRow); gridProfile[iRow, 0] = new SourceGrid.Cells.Cell() { Value = $"{iRow}" }; for (int j = 0; j < 2; ++j) { decimal dValue = (decimal)item[j]; var usedControl = new NumericUpDown() { Minimum = 0.0m, Maximum = 1000.0m, Increment = inc, DecimalPlaces = noDecimalPlaces, Value = dValue }; usedControl.Enter += delegate(object sender, EventArgs e) { IsRechangingSelection = true; foreach (RowInfo rowInfo in gridProfile.Rows) { gridProfile.Selection.SelectRow(rowInfo.Index, false); } foreach (LinkedControlValue lcv in gridProfile.LinkedControls) { if (lcv.Control == usedControl) { gridProfile.Selection.SelectRow(lcv.Position.Row, true); break; } } IsRechangingSelection = false; }; usedControl.ValueChanged += delegate(object sender, EventArgs e) { foreach (LinkedControlValue lcv in gridProfile.LinkedControls) { if (lcv.Control == usedControl && lcv.Control is NumericUpDown nud) { Vector2D v = Profile[lcv.Position.Row - 1]; if (lcv.Position.Column == 1) { Profile[lcv.Position.Row - 1] = new Vector2D((double)nud.Value, v.Y); } else if (lcv.Position.Column == 2) { Profile[lcv.Position.Row - 1] = new Vector2D(v.X, (double)nud.Value); } OnInputChanged(sender, e); } } }; gridProfile[iRow, j + 1] = new SourceGrid.Cells.Cell(); gridProfile.LinkedControls.Add(new LinkedControlValue(usedControl, new SourceGrid.Position(iRow, j + 1))); } } gridProfile.VScrollBar.ValueChanged += delegate(object sender, EventArgs valueChangedEventArgs) { // Hide all linked controls above 'new value' // Show all linked controls beyond 'new value' foreach (LinkedControlValue lcv in gridProfile.LinkedControls) { lcv.Control.Visible = lcv.Position.Row > gridProfile.VScrollBar.Value; } // Reselecting works more or less when scrolling down. But what when scrolling up? if (gridProfile.Selection.ActivePosition.Row <= gridProfile.VScrollBar.Value) { IsRechangingSelection = false; foreach (LinkedControlValue lcv in gridProfile.LinkedControls) { gridProfile.Selection.SelectRow(lcv.Position.Row, false); } IsRechangingSelection = true; gridProfile.Selection.SelectRow(gridProfile.VScrollBar.Value + 1, true); } }; gridProfile.Selection.SelectionChanged += delegate(object sender, RangeRegionChangedEventArgs e) { if (!IsRechangingSelection && e.AddedRange != null && e.RemovedRange == null) { bool isFound = false; int selectedRow = -1; int selectedCol = -1; int[] selectedRows = e.AddedRange.GetRowsIndex(); if (sender is SourceGrid.Selection.SelectionBase) { selectedRow = (sender as SourceGrid.Selection.SelectionBase).ActivePosition.Row; selectedCol = (sender as SourceGrid.Selection.SelectionBase).ActivePosition.Column; } if (selectedRows[0] != -1) { selectedRow = selectedRows[0]; } foreach (LinkedControlValue lcv in gridProfile.LinkedControls) { if (lcv.Position.Row == selectedRow) { // Remove focus from control isFound = true; lcv.Control.Focus(); break; } } if (!isFound) { IsRechangingSelection = true; gridProfile.Selection.Focus(new SourceGrid.Position(selectedRow, selectedCol), true); IsRechangingSelection = false; } } }; gridProfile.AutoSizeCells(); gridProfile.AutoStretchColumnsToFitWidth = true; gridProfile.Invalidate(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void FillGrid() { try { // remove all existing rows gridSolutions.Rows.Clear(); // *** IViews // captionHeader SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.SteelBlue, Border = DevAge.Drawing.RectangleBorder.NoBorder }; captionHeader.Background = veHeaderCaption; captionHeader.ForeColor = Color.Black; captionHeader.Font = new Font("Arial", GridFontSize, FontStyle.Bold); captionHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; // viewRowHeader SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.Black; viewColumnHeader.Font = new Font("Arial", GridFontSize, FontStyle.Regular); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** // set first row gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 7; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header int iCol = 0, iRow = -1; gridSolutions.Rows.Insert(++iRow); // layer pattern gridSolutions[0, iCol++] = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYERPATTERN) { AutomaticSortEnabled = false, View = viewColumnHeader }; // case count gridSolutions[0, iCol++] = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASECOUNT) { AutomaticSortEnabled = false, View = viewColumnHeader }; // efficiency gridSolutions[0, iCol++] = new SourceGrid.Cells.ColumnHeader(Resources.ID_EFFICIENCYPERCENTAGE) { AutomaticSortEnabled = false, View = viewColumnHeader }; // pallet weight gridSolutions[0, iCol++] = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETWEIGHT, UnitsManager.MassUnitString)) { AutomaticSortEnabled = false, View = viewColumnHeader }; // pallet height gridSolutions[0, iCol++] = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETHEIGHT, UnitsManager.LengthUnitString)) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions.AutoStretchRowsToFitHeight = true; SourceGrid.Cells.Controllers.ToolTipText toolTipController = new SourceGrid.Cells.Controllers.ToolTipText { ToolTipTitle = "", ToolTipIcon = ToolTipIcon.None, IsBalloon = false }; foreach (Layer2D layer in _layers) { gridSolutions.Rows.Insert(++iRow); iCol = 0; // layer pattern gridSolutions[iRow, iCol] = new SourceGrid.Cells.Image(TryGenerateLayerImage(layer)) { ToolTipText = layer.Name }; gridSolutions[iRow, iCol++].AddController(toolTipController); using (FastEvaluatorLayer2Pallet evaluator = new FastEvaluatorLayer2Pallet(layer, SelectedPackable, SelectedPallet, BuildConstraintSet())) { // case count gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell( string.Format(Resources.ID_CASECOUNTFORMATSTRING, evaluator.ItemCount, evaluator.NoItemsPerLayer, evaluator.NoLayers)); // volume efficiency gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "{0:0.##}", evaluator.VolumeEfficiency)); // pallet weight gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "{0:0.#}", evaluator.PalletWeight)); // pallet height gridSolutions[iRow, iCol++] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "{0:0.##}", evaluator.PalletHeight)); } } gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution if (gridSolutions.RowsCount > 1) { gridSolutions.Selection.SelectRow(1, true); } else { graphCtrl.Invalidate(); } } catch (Exception ex) { _log.Error(ex.Message); } }
public override void UpdateGrid() { // remove all existing rows gridSolutions.Rows.Clear(); // *** IViews // captionHeader SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.SteelBlue, Border = DevAge.Drawing.RectangleBorder.NoBorder }; captionHeader.Background = veHeaderCaption; captionHeader.ForeColor = Color.Black; captionHeader.Font = new Font("Arial", GridFontSize, FontStyle.Bold); captionHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; // viewRowHeader SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader backHeader = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }; viewRowHeader.Background = backHeader; viewRowHeader.ForeColor = Color.Black; viewRowHeader.Font = new Font("Arial", GridFontSize, FontStyle.Regular); // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** SourceGrid.Cells.RowHeader rowHeader; int iRow = -1; // case caption gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_CASECOUNT) { ColumnSpan = 2, View = captionHeader }; gridSolutions[iRow, 0] = rowHeader; // layer # gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_LAYERCOUNT) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell(_solution.LayerCount); // interlayer # if (_solution.InterlayerCount > 0) { gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_INTERLAYERCOUNT) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell(_solution.InterlayerCount); } // *** Item # (recursive count) Packable content = _analysis.Content; int itemCount = _solution.ItemCount; int number = 1; do { itemCount *= number; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format("{0} #", content.DetailedName)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell(itemCount); }while (null != content && content.InnerContent(ref content, ref number)); // *** // load dimensions BBox3D bboxLoad = _solution.BBoxLoad; // --- gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_LOADDIMENSIONS, UnitsManager.LengthUnitString)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#} x {1:0.#} x {2:0.#}", bboxLoad.Length, bboxLoad.Width, bboxLoad.Height)); // net weight if (_solution.HasNetWeight) { rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_NETWEIGHT_WU, UnitsManager.MassUnitString)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.NetWeight)); } // load weight gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_LOADWEIGHT_WU, UnitsManager.MassUnitString)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.LoadWeight)); // total weight gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_TOTALWEIGHT_WU, UnitsManager.MassUnitString)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.Weight)); // volume efficiency gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_VOLUMEEFFICIENCY) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.VolumeEfficiency)); int noLayerTypesUsed = 0; for (int i = 0; i < _solution.Layers.Count; ++i) { noLayerTypesUsed += _solution.Layers[i].BoxCount > 0 ? 1 : 0; } // ### layers : begin for (int i = 0; i < _solution.NoLayerTypesUsed; ++i) { // layer caption gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(_solution.LayerCaption(i)) { ColumnSpan = 2, View = captionHeader }; gridSolutions[iRow, 0] = rowHeader; // *** Item # (recursive count) content = _analysis.Content; itemCount = _solution.LayerBoxCount(i); number = 1; do { itemCount *= number; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format("{0} #", content.DetailedName)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell(itemCount); }while (null != content && content.InnerContent(ref content, ref number)); // *** // layer weight gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format(Resources.ID_WEIGHT_WU, UnitsManager.MassUnitString)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.LayerWeight(i))); // layer space gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format(Resources.ID_SPACES_WU, UnitsManager.LengthUnitString)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.LayerMaximumSpace(i))); } gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.Invalidate(); }
private void FillGrid() { // remove all existing rows grid.Rows.Clear(); // *** IViews // caption header var captionHeader = new SourceGrid.Cells.Views.RowHeader() { Background = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.SteelBlue, Border = DevAge.Drawing.RectangleBorder.NoBorder }, ForeColor = Color.Black, Font = new Font("Arial", 10, FontStyle.Bold), TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter }; // view column header var viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader() { Background = new DevAge.Drawing.VisualElements.ColumnHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }, ForeColor = Color.Black, Font = new Font("Arial", 10, FontStyle.Regular), }; viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // set first row grid.BorderStyle = BorderStyle.FixedSingle; grid.ColumnsCount = 8; grid.FixedRows = 1; grid.Rows.Insert(0); // header int iCol = 0; SourceGrid.Cells.ColumnHeader columnHeader; // name columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_NAME) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // profile columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_PROFILE) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // thickness columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_THICKNESS) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // ECT columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_ECT) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // RigidityX columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_RIGIDITYX) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // RigidityY columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_RIGIDITYY) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // edit columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_EDIT) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // delete columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_DELETE) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // handling delete event SourceGrid.Cells.Controllers.CustomEvents buttonDelete = new SourceGrid.Cells.Controllers.CustomEvents(); buttonDelete.Click += new EventHandler(OnDeleteItem); SourceGrid.Cells.Controllers.CustomEvents buttonEdit = new SourceGrid.Cells.Controllers.CustomEvents(); buttonEdit.Click += new EventHandler(OnEditItem); // ROWS int iIndex = 0; var dictQuality = CardboardQualityAccessor.Instance.CardboardQualities; foreach (var q in dictQuality) { grid.Rows.Insert(++iIndex); iCol = 0; var quality = q; grid[iIndex, iCol++] = new SourceGrid.Cells.Cell(quality.Name); grid[iIndex, iCol++] = new SourceGrid.Cells.Cell(quality.Profile); grid[iIndex, iCol++] = new SourceGrid.Cells.Cell($"{quality.Thickness:0.##}"); grid[iIndex, iCol++] = new SourceGrid.Cells.Cell($"{quality.ECT:0.##}"); grid[iIndex, iCol++] = new SourceGrid.Cells.Cell($"{quality.RigidityDX:0.##}"); grid[iIndex, iCol++] = new SourceGrid.Cells.Cell($"{quality.RigidityDY:0.##}"); grid[iIndex, iCol] = new SourceGrid.Cells.Button(Properties.Resources.ID_EDIT); grid[iIndex, iCol++].AddController(buttonEdit); grid[iIndex, iCol] = new SourceGrid.Cells.Button("") { Image = Properties.Resources.Delete }; grid[iIndex, iCol++].AddController(buttonDelete); } grid.AutoStretchColumnsToFitWidth = true; grid.AutoSizeCells(); grid.Columns.StretchToFit(); }
private void InitializeGrid() { // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.Black; viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // row header view SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader backRowHeader = new DevAge.Drawing.VisualElements.RowHeader(); backRowHeader.BackColor = Color.LightGray; backRowHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewRowHeader.Background = backRowHeader; viewRowHeader.ForeColor = Color.Black; // create the grid gridDynamicBCT.BorderStyle = BorderStyle.FixedSingle; gridDynamicBCT.ColumnsCount = McKeeFormula.HumidityCoefDictionary.Count + 1; gridDynamicBCT.RowsCount = McKeeFormula.StockCoefDictionary.Count + 1; // column header SourceGrid.Cells.ColumnHeader columnHeader; int indexCol = 0; columnHeader = new SourceGrid.Cells.ColumnHeader("Humidity (%)/Storage"); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridDynamicBCT[0, indexCol++] = columnHeader; foreach (string key in McKeeFormula.HumidityCoefDictionary.Keys) { columnHeader = new SourceGrid.Cells.ColumnHeader(key); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridDynamicBCT[0, indexCol++] = columnHeader; } SourceGrid.Cells.RowHeader rowHeader; int indexRow = 1; foreach (string key in McKeeFormula.StockCoefDictionary.Keys) { rowHeader = new SourceGrid.Cells.RowHeader(key); rowHeader.View = viewRowHeader; gridDynamicBCT[indexRow++, 0] = rowHeader; } gridDynamicBCT.AutoStretchColumnsToFitWidth = true; gridDynamicBCT.AutoSizeCells(); gridDynamicBCT.Columns.StretchToFit(); }
public override void UpdateGrid() { // remove all existing rows gridSolutions.Rows.Clear(); // *** IViews // captionHeader SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader(); veHeaderCaption.BackColor = Color.SteelBlue; veHeaderCaption.Border = DevAge.Drawing.RectangleBorder.NoBorder; captionHeader.Background = veHeaderCaption; captionHeader.ForeColor = Color.Black; captionHeader.Font = new Font("Arial", 10, FontStyle.Bold); captionHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; // viewRowHeader SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader backHeader = new DevAge.Drawing.VisualElements.RowHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewRowHeader.Background = backHeader; viewRowHeader.ForeColor = Color.Black; viewRowHeader.Font = new Font("Arial", 10, FontStyle.Regular); // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** SourceGrid.Cells.RowHeader rowHeader; int iRow = -1; // case caption gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Case"); rowHeader.ColumnSpan = 2; rowHeader.View = captionHeader; gridSolutions[iRow, 0] = rowHeader; // layer # gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Layer #"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell(_solution.LayerCount); // interlayer # if (_solution.InterlayerCount > 0) { gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Interlayer #"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell(_solution.InterlayerCount); } // *** Item # (recursive count) Packable content = _analysis.Content; int itemCount = _solution.ItemCount; int number = 1; do { itemCount *= number; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format("{0} #", content.DetailedName)); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell(itemCount); }while (null != content && content.InnerContent(ref content, ref number)); // *** // load dimensions BBox3D bboxLoad = _solution.BBoxLoad; // --- gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format("Load dimensions\n({0} x {0} * {0})", UnitsManager.LengthUnitString)); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#} x {1:0.#} x {2:0.#}", bboxLoad.Length, bboxLoad.Width, bboxLoad.Height)); // net weight if (_solution.HasNetWeight) { rowHeader = new SourceGrid.Cells.RowHeader( string.Format("Net weight ({0})", UnitsManager.MassUnitString)); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.NetWeight)); } // load weight gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format("Load Weight ({0})", UnitsManager.MassUnitString)); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.LoadWeight)); // total weight gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format("Total weight ({0})", UnitsManager.MassUnitString)); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.Weight)); // volume efficiency gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Vol. efficiency (%)"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.VolumeEfficiency)); int noLayerTypesUsed = 0; for (int i = 0; i < _solution.Layers.Count; ++i) { noLayerTypesUsed += _solution.Layers[i].BoxCount > 0 ? 1 : 0; } // ### layers : begin for (int i = 0; i < _solution.Layers.Count; ++i) { List <int> layerIndexes = _solution.LayerTypeUsed(i); if (0 == layerIndexes.Count) { continue; } // layer caption gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader((noLayerTypesUsed == 1) ? "Layers : All" : BuildLayerCaption(layerIndexes)); rowHeader.ColumnSpan = 2; rowHeader.View = captionHeader; gridSolutions[iRow, 0] = rowHeader; // *** Item # (recursive count) content = _analysis.Content; itemCount = _solution.LayerBoxCount(i); number = 1; do { itemCount *= number; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format("{0} #", content.DetailedName)); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell(itemCount); }while (null != content && content.InnerContent(ref content, ref number)); // *** // layer weight gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Weight"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.LayerWeight(i))); // layer space gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Spaces"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.LayerMaximumSpace(i))); } gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.Invalidate(); }
private void UpdateGrid() { try { // sanity check if (gridSolution.ColumnsCount < 2) { return; } // remove all existing rows gridSolution.Rows.Clear(); // *** IViews // captionHeader SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader(); veHeaderCaption.BackColor = Color.SteelBlue; veHeaderCaption.Border = DevAge.Drawing.RectangleBorder.NoBorder; captionHeader.Background = veHeaderCaption; captionHeader.ForeColor = Color.Black; captionHeader.Font = new Font("Arial", GridFontSize, FontStyle.Bold); captionHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; // viewRowHeader SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader backHeader = new DevAge.Drawing.VisualElements.RowHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewRowHeader.Background = backHeader; viewRowHeader.ForeColor = Color.Black; viewRowHeader.Font = new Font("Arial", GridFontSize, FontStyle.Regular); // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** Solution solution = _analysis.Solution; SourceGrid.Cells.RowHeader rowHeader; int iRow = -1; // pallet caption gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_PALLET); rowHeader.ColumnSpan = 2; rowHeader.View = captionHeader; gridSolution[iRow, 0] = rowHeader; // layer # gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_LAYERNUMBER); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(solution.LayerCount); // interlayer # if (solution.InterlayerCount > 0) { gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_INTERLAYERNUMBER); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(solution.InterlayerCount); } // *** Item # (Recursive count) Packable content = _analysis.Content; int itemCount = solution.ItemCount; int number = 1; do { itemCount *= number; gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format("{0} #", content.DetailedName)); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(itemCount); }while (null != content && content.InnerContent(ref content, ref number)); // *** // outer dimensions BBox3D bboxGlobal = solution.BBoxGlobal; // --- gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_OUTERDIMENSIONS, Environment.NewLine, UnitsManager.LengthUnitString)); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#} x {1:0.#} x {2:0.#}", bboxGlobal.Length, bboxGlobal.Width, bboxGlobal.Height)); // load dimensions BBox3D bboxLoad = solution.BBoxLoad; // --- gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_LOADDIMENSIONS, Environment.NewLine, UnitsManager.LengthUnitString)); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#} x {1:0.#} x {2:0.#}", bboxLoad.Length, bboxLoad.Width, bboxLoad.Height)); // net weight if (solution.HasNetWeight) { gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_NETWEIGHT_WU, UnitsManager.MassUnitString)); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", solution.NetWeight)); } // load weight gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_LOADWEIGHT_WU, UnitsManager.MassUnitString)); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", solution.LoadWeight)); // total weight gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_TOTALWEIGHT_WU, UnitsManager.MassUnitString)); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", solution.Weight)); // volume efficiency gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_VOLUMEEFFICIENCY); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", solution.VolumeEfficiency)); int noLayerTypesUsed = solution.NoLayerTypesUsed; // ### layers : begin for (int i = 0; i < solution.Layers.Count; ++i) { List <int> layerIndexes = solution.LayerTypeUsed(i); if (0 == layerIndexes.Count) { continue; } // layer caption gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(solution.LayerCaption(i)); rowHeader.ColumnSpan = 2; rowHeader.View = captionHeader; gridSolution[iRow, 0] = rowHeader; // *** Item # (recursive count) content = _analysis.Content; itemCount = solution.LayerBoxCount(i); number = 1; do { itemCount *= number; gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format("{0} #", content.DetailedName)); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(itemCount); }while (null != content && content.InnerContent(ref content, ref number)); // *** // layer weight gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format(Resources.ID_WEIGHT_WU, UnitsManager.MassUnitString)); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", solution.LayerWeight(i))); // layer space gridSolution.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Spaces"); rowHeader.View = viewRowHeader; gridSolution[iRow, 0] = rowHeader; gridSolution[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", solution.LayerMaximumSpace(i))); } // ### layers : end gridSolution.AutoSizeCells(); gridSolution.Columns.StretchToFit(); gridSolution.AutoStretchColumnsToFitWidth = true; gridSolution.Invalidate(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
public virtual void UpdateGrid() { try { // sanity check if (gridSolutions.ColumnsCount < 2) { return; } // remove all existing rows gridSolutions.Rows.Clear(); // *** IViews // caption header DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.SteelBlue, Border = DevAge.Drawing.RectangleBorder.NoBorder }; SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader { Background = veHeaderCaption, ForeColor = Color.Black, Font = new Font("Arial", GridFontSize + 2, FontStyle.Bold), TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter }; SourceGrid.Cells.Views.RowHeader captionHeader2 = new SourceGrid.Cells.Views.RowHeader { Background = veHeaderCaption, ForeColor = Color.Black, Font = new Font("Arial", GridFontSize, FontStyle.Regular), TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter }; // viewRowHeader DevAge.Drawing.VisualElements.RowHeader backHeader = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }; SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader { Background = backHeader, ForeColor = Color.Black, Font = new Font("Arial", GridFontSize, FontStyle.Regular) }; // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** int iRow = -1; // ### sol items : begin int solItemIndex = 0; foreach (var solItem in Solution.SolItems) { gridSolutions.Rows.Insert(++iRow); var rowHeader = new SourceGrid.Cells.RowHeader(string.Format(Resources.ID_PALLET_NUMBER, solItemIndex)) { ColumnSpan = 2, View = captionHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_ITEMS) { ColumnSpan = 2, View = captionHeader2 }; gridSolutions[iRow, 0] = rowHeader; var dictNameCount = solItem.SolutionItems; foreach (int containedItemIndex in dictNameCount.Keys) { // name string name = string.Empty; if (Analysis.ContentTypeByIndex(containedItemIndex) is Packable packable) { name = packable.Name; } // count int count = dictNameCount[containedItemIndex]; if (count > 0) { gridSolutions.Rows.Insert(++iRow); var itemHeader = new SourceGrid.Cells.RowHeader(name) { View = viewRowHeader }; gridSolutions[iRow, 0] = itemHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell($"{count}"); } } // pallet data header gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_PALLETDATA) { ColumnSpan = 2, View = captionHeader2 }; gridSolutions[iRow, 0] = rowHeader; // *** // outer dimensions BBox3D bboxGlobal = Solution.BBoxGlobal(solItemIndex); // --- gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_OUTERDIMENSIONS, UnitsManager.LengthUnitString)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture , "{0:0.#} x {1:0.#} x {2:0.#}" , bboxGlobal.Length, bboxGlobal.Width, bboxGlobal.Height)); // load dimensions BBox3D bboxLoad = Solution.BBoxLoad(solItemIndex); gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_LOADDIMENSIONS, UnitsManager.LengthUnitString)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture , "{0:0.#} x {1:0.#} x {2:0.#}" , bboxLoad.Length, bboxLoad.Width, bboxLoad.Height)); // *** // *** // load weight gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_LOADWEIGHT_WU, UnitsManager.MassUnitString)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture, "{0:0.#}", Solution.LoadWeight(solItemIndex))); // total weight gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader( string.Format(Resources.ID_PALLETWEIGHT_WU, UnitsManager.MassUnitString)) { View = viewRowHeader }; gridSolutions[iRow, 0] = rowHeader; gridSolutions[iRow, 1] = new SourceGrid.Cells.Cell( string.Format(CultureInfo.InvariantCulture , "{0:0.#}" , Solution.Weight(solItemIndex))); // *** // increment sol item index ++solItemIndex; } // ### sol items : end gridSolutions.AutoSizeCells(); gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.Invalidate(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void GridInitialize(SourceGrid.Grid grid, List <string> captions) { // remove all existing rows grid.Rows.Clear(); // *** IViews // captionHeader SourceGrid.Cells.Views.RowHeader captionHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader veHeaderCaption = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.SteelBlue, Border = DevAge.Drawing.RectangleBorder.NoBorder }; captionHeader.Background = veHeaderCaption; captionHeader.ForeColor = Color.Black; captionHeader.Font = new Font("Arial", 10, FontStyle.Bold); captionHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; // viewColumnHeader SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.Black; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Regular); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** // set first row grid.BorderStyle = BorderStyle.FixedSingle; grid.ColumnsCount = 4 + captions.Count; grid.FixedRows = 1; grid.Rows.Insert(0); // header int iCol = 0; SourceGrid.Cells.ColumnHeader columnHeader; // name columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_NAME) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // description columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_DESCRIPTION) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // listed captions foreach (string s in captions) { columnHeader = new SourceGrid.Cells.ColumnHeader(s) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; } // delete columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_DELETE) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; }
private void FillGrid() { // clear grid gridSolutions.Rows.Clear(); // border gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 2; gridSolutions.FixedColumns = 1; // header SourceGrid.Cells.RowHeader rowHeader; SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader(); DevAge.Drawing.VisualElements.RowHeader backHeader = new DevAge.Drawing.VisualElements.RowHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewRowHeader.Background = backHeader; viewRowHeader.ForeColor = Color.Black; viewRowHeader.Font = new Font("Arial", 10, FontStyle.Regular); int iRow = -1; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Layer #"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Interlayer #"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Case #"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format("Outer dimensions\n({0} x {0} x {0})", UnitsManager.LengthUnitString)); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format("Load dimensions\n({0} x {0} x {0})", UnitsManager.LengthUnitString)); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format("Load Weight ({0})", UnitsManager.MassUnitString)); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader(string.Format("Total weight ({0})", UnitsManager.MassUnitString)); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions.Rows.Insert(++iRow); rowHeader = new SourceGrid.Cells.RowHeader("Vol. efficiency (%)"); rowHeader.View = viewRowHeader; gridSolutions[iRow, 0] = rowHeader; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Invalidate(); }