Пример #1
0
        public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
        {
            // instantiate solution viewer
            BoxCaseSolutionViewer sv = new BoxCaseSolutionViewer(GetCurrentSolution());

            sv.Draw(graphics);
        }
        public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
        {
            if (null == CurrentSolution)
            {
                return;
            }
            BoxCaseSolutionViewer sv = new BoxCaseSolutionViewer(CurrentSolution);

            sv.Draw(graphics);
        }
        private void FillGrid()
        {
            // fill grid solutions
            gridSolutions.Rows.Clear();

            // 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;

            // 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.White;
            viewColumnHeader.Font                  = new Font("Arial", 10, FontStyle.Bold);
            viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;

            // create the grid
            gridSolutions.BorderStyle = BorderStyle.FixedSingle;

            gridSolutions.ColumnsCount = 5;
            gridSolutions.FixedRows    = 1;
            gridSolutions.Rows.Insert(0);

            // header
            SourceGrid.Cells.ColumnHeader columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_INDEX);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View   = viewColumnHeader;
            gridSolutions[0, 0] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYERPATTERN);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View   = viewColumnHeader;
            gridSolutions[0, 1] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_BUNDLECOUNT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View   = viewColumnHeader;
            gridSolutions[0, 2] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_VOLUMEEFFICIENCY);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View   = viewColumnHeader;
            gridSolutions[0, 3] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASEWEIGHT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View   = viewColumnHeader;
            gridSolutions[0, 4] = columnHeader;

            // data rows
            int iIndex = 0;

            foreach (BoxCaseSolution sol in _analysis.Solutions)
            {
                // build case count string
                string sBoxCount = string.Empty;
                sBoxCount = string.Format("{0}\n({1} * {2})", sol.BoxPerCaseCount, sol.BoxPerLayerCount, sol.Count);
                // insert row
                gridSolutions.Rows.Insert(++iIndex);
                // filling columns
                gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex));
                {
                    Graphics2DImage       graphics = new Graphics2DImage(new Size(80, 40));
                    BoxCaseSolutionViewer sv       = new BoxCaseSolutionViewer(sol);
                    sv.Draw(graphics);
                    gridSolutions[iIndex, 1] = new SourceGrid.Cells.Image(graphics.Bitmap);
                }
                gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(sBoxCount);
                gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.VolumeEfficiencyBoxes));
                gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.CaseWeight));

                gridSolutions[iIndex, 0].View = viewNormal;
                gridSolutions[iIndex, 1].View = viewNormal;
                gridSolutions[iIndex, 2].View = viewNormal;
                gridSolutions[iIndex, 3].View = viewNormal;
                gridSolutions[iIndex, 4].View = viewNormal;
            }

            gridSolutions.AutoStretchColumnsToFitWidth = true;
            gridSolutions.AutoSizeCells();
            gridSolutions.Columns.StretchToFit();

            // select first solution
            gridSolutions.Selection.SelectRow(1, true);
            // redraw
            graphCtrlSolution.Invalidate();
        }