Пример #1
0
        /// <summary>
        /// 建立固定儲存格的內容,包括:標題列、標題行。
        /// </summary>
        private void CreateFixedArea()
        {
            brGrid.FixedColumns = DualEditForm.FixedColumns;
            brGrid.FixedRows    = DualEditForm.FixedRows;

            brGrid[0, 0]            = new SourceGrid.Cells.Header();
            brGrid[0, 0].View       = m_HeaderView;
            brGrid[0, 0].Row.Height = 22;
            //brGrid[0, 0].Column.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;

            // column headers
            int cnt = 0;

            for (int col = FixedColumns; col < brGrid.ColumnsCount; col++)
            {
                cnt++;
                SourceGrid.Cells.ColumnHeader hdr = new SourceGrid.Cells.ColumnHeader(cnt.ToString());
                //hdr.EnableResize = false;
                brGrid[0, col]      = hdr;
                brGrid[0, col].View = m_HeaderView;
            }

            // row headers
            cnt = 1;
            for (int row = FixedRows; row < brGrid.RowsCount; row += 3)
            {
                SourceGrid.Cells.RowHeader hdr = new SourceGrid.Cells.RowHeader(cnt.ToString());
                brGrid[row, 0]      = hdr;
                brGrid[row, 0].View = m_HeaderView;
                hdr.RowSpan         = 3;                // 不可以在指定 hdr 物件之前設定 RowSpan, 否則會出錯!
                cnt++;
            }

            RefreshRowNumbers();
        }
Пример #2
0
        private void SetGrid()
        {
            grid1.Redim(74, 8);
            // grid1.FixedRows = 2;
            // grid1.FixedColumns = 1;

            for (int i = 0; i < colCaption.Length; i++)
            {
                grid1[rowIndex[i], colIndex[i]]            = new SourceGrid.Cells.Header(colCaption[i]);
                grid1[rowIndex[i], colIndex[i]].RowSpan    = rowSpan[i];
                grid1[rowIndex[i], colIndex[i]].ColumnSpan = colSpan[i];
                grid1[rowIndex[i], colIndex[i]].View       = GridView.HeaderView;
            }
            grid1.Rows[0].Height          = 25;
            grid1.Rows[1].Height          = 25;
            grid1.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.None;

            for (int i = 0; i < 72; i++)
            {
                grid1[i + 2, 0] = new SourceGrid.Cells.RowHeader(i + 1);
                grid1[i + 2, 1] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 2] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 3] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 4] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 5] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 6] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 7] = new SourceGrid.Cells.Cell("", typeof(string));
            }

            grid1.AutoSizeCells();
            grid1.AutoStretchColumnsToFitWidth = true;
            grid1.Columns.StretchToFit();
        }
Пример #3
0
 public void DoFullTab4_frez()
 {
     #region SQLite Connection
     sqlite_conn = new SQLiteConnection("Data Source=databaseF.sqlite;Version=3;New=True;Compress=True;"); // create a new databaseF connection
     sqlite_conn.Open();                                                                                   // open the connection:
     sqlite_cmd             = sqlite_conn.CreateCommand();                                                 // create a new SQL command
     sqlite_cmd.CommandText = "SELECT * FROM FrParamKp";                                                   // First lets build a SQL-Query again
     sqlite_datareader      = sqlite_cmd.ExecuteReader();                                                  // The SQLiteDataReader allows us to run through the result lines
     #endregion
     #region Код таблицы 4 (Коэф. Kp)
     grid4Frez.BorderStyle = BorderStyle.FixedSingle;
     grid4Frez.Redim(3, 2);
     grid4Frez[0, 0] = new SourceGrid.Cells.ColumnHeader("Обрабатываемый \nматериал");
     grid4Frez[0, 1] = new SourceGrid.Cells.ColumnHeader("Коэффицент Kp");
     for (int r = 1; r < 3; r++)
     {
         if (sqlite_datareader.Read())
         {
             grid4Frez[r, 0] = new SourceGrid.Cells.RowHeader(Convert.ToString(sqlite_datareader.GetString(0)));
             grid4Frez[r, 1] = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(1)), typeof(float));
             grid4Frez[r, 0].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
         }
         grid4Frez[r, 1].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
         grid4Frez[r, 1].AddController(clickEvent);              //клик мыши
         grid4Frez[r, 1].AddController(cellpointer);             //наведение
         grid4Frez[r, 1].Editor.EnableEdit = false;              //нередактируемые ячейки
         grid4Frez[r, 1].AddController(new SourceGrid.Cells.Controllers.Unselectable());
         grid4Frez[r, 1].AddController(new MyHelpRowTracking()); //help row pointer
     }
     grid4Frez.AutoSizeCells();
     grid4Frez.EnableSort = false;
     grid4Frez.Selection.EnableMultiSelection = false;
     sqlite_conn.Close();
     #endregion
 }
Пример #4
0
        private void frmSample17_Load(object sender, System.EventArgs e)
        {
            grid1.Redim(40, 40);
            grid1.FixedColumns = 1;
            grid1.FixedRows    = 1;

            grid1[0, 0] = new SourceGrid.Cells.Header(null);
            for (int c = 1; c < grid1.ColumnsCount; c++)
            {
                SourceGrid.Cells.ColumnHeader header = new SourceGrid.Cells.ColumnHeader("Header " + c.ToString());
                header.AutomaticSortEnabled = false;

                //header.ColumnSelectorEnabled = true;
                //header.ColumnFocusEnabled = true;

                grid1[0, c] = header;
            }

            Random rnd = new Random();

            for (int r = 1; r < grid1.RowsCount; r++)
            {
                grid1[r, 0] = new SourceGrid.Cells.RowHeader("Header " + r.ToString());
                for (int c = 1; c < grid1.ColumnsCount; c++)
                {
                    if (rnd.NextDouble() > 0.20)
                    {
                        grid1[r, c] = new SourceGrid.Cells.Cell(r * c, typeof(int));
                    }
                    else
                    {
                        grid1[r, c] = null;
                    }
                }
            }

            var selection = grid1.Selection as SelectionBase;

            cPickSelBackColor.SelectedColor = Color.FromArgb(selection.BackColor.R, selection.BackColor.G, selection.BackColor.B);
            cPckBorderColor.SelectedColor   = selection.Border.Top.Color;
            trackSelectionAlpha.Value       = (int)selection.BackColor.A;
            trackBorderWidth.Value          = (int)selection.Border.Top.Width;

            cPickFocusBackColor.SelectedColor = Color.FromArgb(selection.FocusBackColor.R, selection.FocusBackColor.G, selection.FocusBackColor.B);
            trackFocusBackColorTrans.Value    = selection.FocusBackColor.A;


            this.cPickSelBackColor.SelectedColorChanged   += new System.EventHandler(this.cPickSelBackColor_SelectedColorChanged);
            this.cPckBorderColor.SelectedColorChanged     += new System.EventHandler(this.cPckBorderColor_SelectedColorChanged);
            this.trackSelectionAlpha.ValueChanged         += new System.EventHandler(this.trackSelectionAlpha_ValueChanged);
            this.trackBorderWidth.ValueChanged            += new System.EventHandler(this.trackBorderWidth_ValueChanged);
            this.trackFocusBackColorTrans.ValueChanged    += new System.EventHandler(this.trackFocusBackColorTrans_ValueChanged);
            this.cPickFocusBackColor.SelectedColorChanged += new System.EventHandler(this.cPickFocusBackColor_SelectedColorChanged);

            cbDashStyle.Validator = new DevAge.ComponentModel.Validator.ValidatorTypeConverter(typeof(System.Drawing.Drawing2D.DashStyle));
            cbDashStyle.Value     = selection.Border.Top.DashStyle;
        }
Пример #5
0
        private void btLoad_Click(object sender, System.EventArgs e)
        {
            grid.Redim(0, 0);
            //Visual properties shared between all the cells
            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
            view.BackColor = Color.Snow;

            //Editor (IDataModel) shared between all the cells
            SourceGrid.Cells.Editors.TextBox editor = new
                                                      SourceGrid.Cells.Editors.TextBox(typeof(string));

            grid.Redim(int.Parse(txtRows.Text), int.Parse(txtCols.Text));

            if (chkAddHeaders.Checked && grid.RowsCount > 0 &&
                grid.ColumnsCount > 0)
            {
                grid.FixedRows    = 1;
                grid.FixedColumns = 1;

                for (int r = grid.FixedRows; r < grid.RowsCount; r++)
                {
                    grid[r, 0] = new SourceGrid.Cells.RowHeader(r);
                }
                for (int c = grid.FixedColumns; c < grid.ColumnsCount; c++)
                {
                    SourceGrid.Cells.ColumnHeader header = new
                                                           SourceGrid.Cells.ColumnHeader(c);
                    header.AutomaticSortEnabled = false;
                    grid[0, c] = header;
                }
                grid[0, 0] = new SourceGrid.Cells.Header();
            }
            else
            {
                grid.FixedRows    = 0;
                grid.FixedColumns = 0;
            }

            for (int r = grid.FixedRows; r < grid.RowsCount; r++)
            {
                for (int c = grid.FixedColumns; c < grid.ColumnsCount; c++)
                {
                    grid[r, c] = new SourceGrid.Cells.Cell(r.ToString() + "," +
                                                           c.ToString());
                    grid[r, c].Editor = editor;
                    grid[r, c].View   = view;
                }
            }
            grid.Selection.Focus(new SourceGrid.Position(0, 0), true);
        }
Пример #6
0
        private void LoadSchedule()
        {
            ScheduleGrid.BorderStyle = BorderStyle.None;
            ScheduleGrid.Rows.Insert(0);
            List <Worker> todayWorker = Enterprise.Personal.FindAll(date => date.TimeTable.Data.ContainsKey(monthCalendar.SelectionStart));

            ScheduleGrid.ColumnsCount = todayWorker.Count + 1;
            ScheduleGrid[0, 0]        = new SourceGrid.Cells.ColumnHeader(string.Empty);
            for (int i = 1; i <= todayWorker.Count; i++)
            {
                ScheduleGrid[0, i] = new SourceGrid.Cells.ColumnHeader($"{todayWorker[i - 1].About.Name}");
            }
            ScheduleGrid.FixedRows = 1;

            int j = 1;

            try
            {
                for (TimeSpan i = Enterprise.TimeTable[(Days)IndexDay() + 1][0];
                     i < Enterprise.TimeTable[(Days)IndexDay() + 1][1];
                     i = i + DateTime.Parse("00:30:00").TimeOfDay)
                {
                    ScheduleGrid.Rows.Insert(j);
                    ScheduleGrid[j, 0] = new SourceGrid.Cells.RowHeader($"{i} - {(i + DateTime.Parse("00:30:00").TimeOfDay)}");
                    for (int k = 1; k < ScheduleGrid.ColumnsCount; k++)
                    {
                        if (todayWorker[k - 1].TimeTable.Data[monthCalendar.SelectionStart.Date].End <= i ||
                            todayWorker[k - 1].TimeTable.Data[monthCalendar.SelectionStart.Date].Start > i)
                        {
                            ScheduleGrid[j, k]             = new SourceGrid.Cells.Cell("Не работает", typeof(string));
                            ScheduleGrid[j, k].ToolTipText = string.Empty;
                        }
                        else
                        {
                            ScheduleGrid[j, k]             = new SourceGrid.Cells.Cell(string.Empty, typeof(string));
                            ScheduleGrid[j, k].ToolTipText = string.Empty;
                        }
                    }
                    j++;
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                ScheduleGrid.Rows.RemoveRange(0, ScheduleGrid.Rows.Count);
            }
            finally
            {
                ScheduleGrid.AutoSizeCells();
            }
        }
        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());
            }
        }
Пример #8
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            currencyFormat.TypeConverter = new DevAge.ComponentModel.Converter.CurrencyTypeConverter(typeof(double));
            currencyView.TextAlignment   = DevAge.Drawing.ContentAlignment.MiddleRight;
            dateFormat.TypeConverter     = new DevAge.ComponentModel.Converter.DateTimeTypeConverter("MMM yyyy");

            grid1.Redim(8, 21);
            grid1.FixedColumns = 1;
            grid1.FixedRows    = 1;

            grid1[0, 0] = new SourceGrid.Cells.Header();

            //row headers
            grid1[1, 0]         = new SourceGrid.Cells.RowHeader("Revenue");
            grid1[2, 0]         = new SourceGrid.Cells.RowHeader("Employees Cost");
            grid1[3, 0]         = new SourceGrid.Cells.RowHeader("Tax");
            grid1[4, 0]         = new SourceGrid.Cells.RowHeader("Totals");
            grid1[4, 0].RowSpan = 4;

            Random rnd = new Random();

            for (int i = 0; i < 20; i++)
            {
                AddDate(i + 1, DateTime.Now.AddMonths(i), 2000 * rnd.NextDouble(), 1000 * rnd.NextDouble(), 500 * rnd.NextDouble());
            }

            //Totals
            grid1[4, 1] = new CellTotal("Revenue: ");
            grid1[4, 2] = new CellTotal(mTotRevenue.ToString("C"));
            grid1[5, 1] = new CellTotal("Employees Cost: ");
            grid1[5, 2] = new CellTotal(mTotEmployeesCost.ToString("C"));
            grid1[6, 1] = new CellTotal("Tax: ");
            grid1[6, 2] = new CellTotal(mTotTax.ToString("C"));
            grid1[7, 1] = new CellTotal("Total:");
            grid1[7, 2] = new CellTotal((mTotRevenue - (mTotEmployeesCost + mTotTax)).ToString("C"));

            grid1.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.None;
            grid1.Columns[1].Width        = 100;
            grid1.Columns[2].AutoSizeMode = SourceGrid.AutoSizeMode.None;
            grid1.Columns[2].Width        = 100;
            grid1.Rows[4].AutoSizeMode    = SourceGrid.AutoSizeMode.None;
            grid1.Rows[5].AutoSizeMode    = SourceGrid.AutoSizeMode.None;
            grid1.Rows[6].AutoSizeMode    = SourceGrid.AutoSizeMode.None;
            grid1.Rows[7].AutoSizeMode    = SourceGrid.AutoSizeMode.None;
            grid1.AutoSizeCells();
        }
Пример #9
0
        public void RecurInsertContent(ref int iRow, Packable content, int number)
        {
            gridSolution.Rows.Insert(++iRow);
            SourceGrid.Cells.RowHeader rowHeader = new SourceGrid.Cells.RowHeader($"{content.DetailedName} #")
            {
                View = CellProperties.VisualPropValue
            };
            gridSolution[iRow, 0] = rowHeader;
            gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(number);

            List <Pair <Packable, int> > listContentItems = new List <Pair <Packable, int> >();

            content.InnerContent(ref listContentItems);
            foreach (var item in listContentItems)
            {
                RecurInsertContent(ref iRow, item.first, item.second * number);
            }
        }
Пример #10
0
        public void DoFullTab2_frez()
        {
            #region Код таблицы 2 (Зав z от D)

            grid2Frez.BorderStyle = BorderStyle.FixedSingle;
            grid2Frez.Redim(2, 10);
            //заголовок
            grid2Frez[0, 0] = new SourceGrid.Cells.RowHeader("D, мм");
            grid2Frez[0, 1] = new SourceGrid.Cells.RowHeader("10-18");
            grid2Frez[0, 2] = new SourceGrid.Cells.RowHeader("19-28");
            grid2Frez[0, 3] = new SourceGrid.Cells.RowHeader("29-50");
            grid2Frez[0, 4] = new SourceGrid.Cells.RowHeader("51-63");
            grid2Frez[0, 5] = new SourceGrid.Cells.RowHeader("64-80");
            grid2Frez[0, 6] = new SourceGrid.Cells.RowHeader("81-100");
            grid2Frez[0, 7] = new SourceGrid.Cells.RowHeader("101-125");
            grid2Frez[0, 8] = new SourceGrid.Cells.RowHeader("126-160");
            grid2Frez[0, 9] = new SourceGrid.Cells.RowHeader("161-200");
            grid2Frez[1, 0] = new SourceGrid.Cells.RowHeader("z");
            grid2Frez[0, 0].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            grid2Frez[0, 1].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            grid2Frez[1, 1] = new SourceGrid.Cells.Cell(Convert.ToString(3), typeof(string));
            grid2Frez[1, 2] = new SourceGrid.Cells.Cell(Convert.ToString(3), typeof(string));
            grid2Frez[1, 3] = new SourceGrid.Cells.Cell(Convert.ToString(4), typeof(string));
            grid2Frez[1, 4] = new SourceGrid.Cells.Cell(Convert.ToString(5), typeof(string));
            grid2Frez[1, 5] = new SourceGrid.Cells.Cell(Convert.ToString(8), typeof(string));
            grid2Frez[1, 6] = new SourceGrid.Cells.Cell(Convert.ToString(10), typeof(string));
            grid2Frez[1, 7] = new SourceGrid.Cells.Cell(Convert.ToString(12), typeof(string));
            grid2Frez[1, 8] = new SourceGrid.Cells.Cell(Convert.ToString(14), typeof(string));
            grid2Frez[1, 9] = new SourceGrid.Cells.Cell(Convert.ToString(18), typeof(string));
            for (int c = 1; c < 10; c++)
            {
                grid2Frez[1, c].AddController(clickEvent);              //клик мыши
                grid2Frez[1, c].AddController(cellpointer);             //наведение
                grid2Frez[1, c].Editor.EnableEdit = false;              //нередактируемые ячейки
                grid2Frez[1, c].AddController(new SourceGrid.Cells.Controllers.Unselectable());
                grid2Frez[1, c].AddController(new MyHelpRowTracking()); //help row pointer
            }
            grid2Frez.AutoSizeCells();
            grid2Frez.EnableSort = false;
            grid2Frez.Selection.EnableMultiSelection = false;
            #endregion
        }
Пример #11
0
        private void brAddRow_Click(object sender, System.EventArgs e)
        {
            int row = grid1.RowsCount;

            grid1.Rows.Insert(row);

            grid1[row, 0] = new SourceGrid.Cells.RowHeader(null);
            grid1[row, 1] = new SourceGrid.Cells.Cell(grid1.RowsCount, mEditor_Id);
            grid1[row, 2] = new SourceGrid.Cells.Cell(mEditor_Name.DefaultValue, mEditor_Name);
            grid1[row, 3] = new SourceGrid.Cells.Cell(mEditor_Address.DefaultValue, mEditor_Address);
            grid1[row, 4] = new SourceGrid.Cells.Cell(mEditor_City.DefaultValue, mEditor_City);
            grid1[row, 5] = new SourceGrid.Cells.Cell(mEditor_BirthDay.DefaultValue, mEditor_BirthDay);
            grid1[row, 6] = new SourceGrid.Cells.Cell(mEditor_Country.DefaultValue, mEditor_Country);
            grid1[row, 7] = new SourceGrid.Cells.Cell(mEditor_Price.DefaultValue, mEditor_Price);
            grid1[row, 8] = new SourceGrid.Cells.CheckBox(null, false);

            SourceGrid.Cells.Link link = new SourceGrid.Cells.Link("http://www.codeproject.com");
            link.AddController(mController_Link);
            grid1[row, 9] = link;

            grid1.Selection.FocusRow(row);
        }
Пример #12
0
        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;
        }
Пример #13
0
        private void UpdateGrid()
        {
            try
            {
                // sanity check
                if (gridSolution.ColumnsCount < 2)
                {
                    return;
                }
                // remove all existing rows
                gridSolution.Rows.Clear();
                // cell visual properties
                var vPropHeader = CellProperties.VisualPropHeader;
                var vPropValue  = CellProperties.VisualPropValue;

                int iRow = -1;
                // pallet caption
                gridSolution.Rows.Insert(++iRow);
                gridSolution[iRow, 0] = new ColumnHeaderSolution(Resources.ID_TRUCK)
                {
                    ColumnSpan = 1
                };
                gridSolution[iRow, 1] = new ColumnHeaderSolution(string.Empty)
                {
                    ColumnSpan = 1
                };
                // layer #
                gridSolution.Rows.Insert(++iRow);
                gridSolution[iRow, 0] = new SourceGrid.Cells.RowHeader(Resources.ID_LAYERNUMBER)
                {
                    View = vPropValue
                };
                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);
                    gridSolution[iRow, 0] = new SourceGrid.Cells.RowHeader(string.Format("{0} #", content.DetailedName))
                    {
                        View = vPropValue
                    };
                    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);
                gridSolution[iRow, 0] = new SourceGrid.Cells.RowHeader(
                    string.Format(Resources.ID_LOADDIMENSIONS, UnitsManager.LengthUnitString))
                {
                    View = vPropValue
                };
                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);
                    gridSolution[iRow, 0] = new SourceGrid.Cells.RowHeader(
                        string.Format(Resources.ID_NETWEIGHT_WU, UnitsManager.MassUnitString))
                    {
                        View = vPropValue
                    };
                    gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(
                        string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.NetWeight.Value));
                }
                // load weight
                gridSolution.Rows.Insert(++iRow);
                gridSolution[iRow, 0] = new SourceGrid.Cells.RowHeader(
                    string.Format(Resources.ID_LOADWEIGHT_WU, UnitsManager.MassUnitString))
                {
                    View = vPropValue
                };
                gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(
                    string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.LoadWeight));
                // total weight
                gridSolution.Rows.Insert(++iRow);
                gridSolution[iRow, 0] = new SourceGrid.Cells.RowHeader(string.Format(Resources.ID_TOTALWEIGHT_WU, UnitsManager.MassUnitString))
                {
                    View = vPropValue
                };
                gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(
                    string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.Weight));
                // volume efficiency
                gridSolution.Rows.Insert(++iRow);
                gridSolution[iRow, 0] = new SourceGrid.Cells.RowHeader(Resources.ID_VOLUMEEFFICIENCY)
                {
                    View = vPropValue
                };
                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 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();
        }
Пример #15
0
        public virtual void UpdateGrid()
        {
            try
            {
                // remove all existing rows
                gridSolution.Rows.Clear();

                // cell visual properties
                var vPropHeader = CellProperties.VisualPropHeader;
                var vPropValue  = CellProperties.VisualPropValue;

                SourceGrid.Cells.RowHeader rowHeader;
                int iRow = -1;

                // loading caption
                gridSolution.Rows.Insert(++iRow);
                rowHeader = new SourceGrid.Cells.RowHeader(GridCaption)
                {
                    ColumnSpan = 2,
                    View       = vPropHeader
                };
                gridSolution[iRow, 0] = rowHeader;

                // *** Item # (Recursive count)
                Packable content   = Analysis.Content;
                var      solution  = Analysis.Solution;
                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 = vPropValue
                    };
                    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 = vPropValue
                };
                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));
                // total dimensions
                BBox3D bboxGlobal = solution.BBoxGlobal;
                // ---
                gridSolution.Rows.Insert(++iRow);
                rowHeader = new SourceGrid.Cells.RowHeader(
                    string.Format(Resources.ID_DIMENSIONS, UnitsManager.LengthUnitString))
                {
                    View = vPropValue
                };
                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));
                // net weight
                if (Analysis.Solution.HasNetWeight)
                {
                    gridSolution.Rows.Insert(++iRow);
                    rowHeader = new SourceGrid.Cells.RowHeader(
                        string.Format(Resources.ID_NETWEIGHT_WU, UnitsManager.MassUnitString))
                    {
                        View = vPropValue
                    };
                    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 = vPropValue
                };
                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 = vPropValue
                };
                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 = vPropValue
                };
                gridSolution[iRow, 0] = rowHeader;
                gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(
                    string.Format(CultureInfo.InvariantCulture, "{0:0.#}", solution.VolumeEfficiency));

                gridSolution.AutoSizeCells();
                gridSolution.AutoStretchColumnsToFitWidth = true;
                gridSolution.Invalidate();
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
Пример #16
0
        private void SetGrid()
        {
            grid1.Redim(74,8);
            grid1.FixedRows = 2;
            grid1.FixedColumns = 1;

            for (int i = 0; i < colCaption.Length; i++)
            {
                grid1[rowIndex[i], colIndex[i]] = new SourceGrid.Cells.Header(colCaption[i]);
                grid1[rowIndex[i], colIndex[i]].RowSpan = rowSpan[i];
                grid1[rowIndex[i], colIndex[i]].ColumnSpan = colSpan[i];
                grid1[rowIndex[i], colIndex[i]].View = GridView.HeaderView;
            }
            grid1.Rows[0].Height = 25;
            grid1.Rows[1].Height = 25;
            grid1.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.None;

            for (int i = 0; i < 72; i++)
            {
                grid1[i + 2, 0] = new SourceGrid.Cells.RowHeader(i+1);
                grid1[i + 2, 1] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 2] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 3] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 4] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 5] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 6] = new SourceGrid.Cells.Cell("", typeof(string));
                grid1[i + 2, 7] = new SourceGrid.Cells.Cell("", typeof(string));
            }

            grid1.AutoSizeCells();
            grid1.AutoStretchColumnsToFitWidth = true;
            grid1.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 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();
        }
Пример #19
0
        void ExecuteWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            mnuExecute.Text           = "Execute";
            mnuExecute.ForeColor      = SystemColors.ControlText;
            mnuRun.Enabled            = true;
            mnuSchema.Enabled         = true;
            this.Cursor               = Cursors.Default;
            textEditorControl1.Cursor = Cursors.Default;
            timer.Stop();

            if (e.Cancelled)
            {
                lblCurrentStatus.Text = string.Format("Query cancelled");
            }
            else if (e.Error != null)
            {
                this.Cursor = Cursors.Default;
                Program.logger.ErrorException("Execute", e.Error);
                lblCurrentStatus.Text = "Error: " + e.Error.Message;
                MessageBox.Show("An error occurred executing sql statement data:\n" + e.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (e.Result != null && e.Result is IList <IList <object> > )
            {
                IList <IList <object> > result = (IList <IList <object> >)e.Result;

                grid1.ClipboardMode = SourceGrid.ClipboardMode.All;
                grid1.Rows.Clear();
                grid1.FixedRows    = 1;
                grid1.FixedColumns = 1;
                SourceGrid.Cells.Editors.EditorBase editor = new SourceGrid.Cells.Editors.TextBox(typeof(string));
                editor.EnableEdit = false;

                // Set the column count
                int colCount = result[0].Count;
                grid1.ColumnsCount = colCount + 1; // Extra one for header

                // Write the header
                grid1.Rows.Insert(0);
                grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("");
                for (int c = 0; c < colCount; c++)
                {
                    grid1[0, c + 1] = new SourceGrid.Cells.ColumnHeader(result[0][c]);
                }

                int i = 0;

                // Write the values
                foreach (List <object> row in result.Skip(1))
                {
                    i++;
                    grid1.Rows.Insert(i);
                    grid1[i, 0] = new SourceGrid.Cells.RowHeader(i.ToString());
                    for (int c = 0; c < colCount; c++)
                    {
                        if (row[c] == null)
                        {
                            grid1[i, c + 1] = new SourceGrid.Cells.Cell("", typeof(string));
                        }
                        else if (row[c] == typeof(DateTime))
                        {
                            grid1[i, c + 1] = new SourceGrid.Cells.Cell(((DateTime)row[c]).ToString("yyyy-MM-dd HH:mm:ss"), typeof(string));
                        }
                        else if (row[c] == typeof(string))
                        {
                            grid1[i, c + 1] = new SourceGrid.Cells.Cell(row[c].ToString().Trim(), typeof(string));
                        }
                        else
                        {
                            grid1[i, c + 1] = new SourceGrid.Cells.Cell(row[c], typeof(double));
                        }

                        grid1[i, c + 1].Editor = editor;
                    }
                }

                grid1.AutoSizeCells();
                grid1.Visible         = true;
                lblCurrentStatus.Text = string.Format("Query completed in {0}s", DateTime.Now.Subtract(start).TotalSeconds);
            }
        }
Пример #20
0
        private static void Build(Grid a, int m, int n, Color warna, HeaderColumnsHeader headerstate = HeaderColumnsHeader.both, ResizeColumns autoresize = ResizeColumns.autocell, string pointzero = "#", string[] headername = null, int positionx = 0, int positiony = 0, SorterColumns sortable = SorterColumns.sort)
        {
            try
            {
                MakeGrid.Reset(a, m, n, headerstate);

                SourceGrid.Cells.Views.Cell      view   = new SourceGrid.Cells.Views.Cell();
                SourceGrid.Cells.Editors.TextBox editor = new SourceGrid.Cells.Editors.TextBox(typeof(string));
                view.BackColor = warna;

                if (headerstate == HeaderColumnsHeader.both || headerstate == HeaderColumnsHeader.rows)
                {
                    for (int r = a.FixedRows; r < a.RowsCount; r++)
                    {
                        a[r, 0] = new SourceGrid.Cells.RowHeader(r);
                    }
                }

                if (headerstate == HeaderColumnsHeader.both || headerstate == HeaderColumnsHeader.columns)
                {
                    try
                    {
                        for (int c = a.FixedColumns; c < a.ColumnsCount; c++)
                        {
                            SourceGrid.Cells.ColumnHeader header = new
                                                                   SourceGrid.Cells.ColumnHeader(headername[c - 1]);
                            header.AutomaticSortEnabled = true;
                            header.View.TextAlignment   = ContentAlignment.MiddleCenter;
                            a[0, c] = header;
                        }
                    }
                    catch
                    {
                    }
                }

                SourceGrid.Cells.ColumnHeader header1 = new SourceGrid.Cells.ColumnHeader(pointzero);

                if (sortable == SorterColumns.sort)
                {
                    header1.SortComparer = new SourceGrid.MultiColumnsComparer(1, 2, 3, 4);
                }

                a[0, 0] = header1;

                for (int r = a.FixedRows; r < a.RowsCount; r++)
                {
                    for (int c = a.FixedColumns; c < a.ColumnsCount; c++)
                    {
                        a[r, c]        = new SourceGrid.Cells.Cell("");
                        a[r, c].Editor = editor;
                        a[r, c].View   = view;
                    }
                }

                a.Update();
                a.Selection.Focus(new SourceGrid.Position(positionx, positiony), true);

                if (autoresize == ResizeColumns.autocell)
                {
                    a.AutoSizeCells();
                }
            }
            catch
            {
            }
        }
        public override void UpdateGrid()
        {
            // remove all existing rows
            gridSolution.Rows.Clear();

            // cell visual properties
            var vPropCaption = CellProperties.VisualPropHeader;
            var vPropValue   = CellProperties.VisualPropValue;

            SourceGrid.Cells.RowHeader rowHeader;
            int iRow = -1;

            // case caption
            gridSolution.Rows.Insert(++iRow);
            rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_CASECOUNT)
            {
                ColumnSpan = 2,
                View       = vPropCaption
            };
            gridSolution[iRow, 0] = rowHeader;
            // layer #
            gridSolution.Rows.Insert(++iRow);
            rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_LAYERCOUNT)
            {
                View = vPropValue
            };
            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_INTERLAYERCOUNT)
                {
                    View = vPropValue
                };
                gridSolution[iRow, 0] = rowHeader;
                gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(_solution.InterlayerCount);
            }
            // *** Item # (recursive count)
            RecurInsertContent(ref iRow, _analysis.Content, _solution.ItemCount);
            // ***
            // load dimensions
            BBox3D bboxLoad = _solution.BBoxLoad;

            // ---
            gridSolution.Rows.Insert(++iRow);
            rowHeader = new SourceGrid.Cells.RowHeader(
                string.Format(Resources.ID_LOADDIMENSIONS, UnitsManager.LengthUnitString))
            {
                View = vPropValue
            };
            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)
            {
                rowHeader = new SourceGrid.Cells.RowHeader(
                    string.Format(Resources.ID_NETWEIGHT_WU, UnitsManager.MassUnitString))
                {
                    View = vPropValue
                };
                gridSolution[iRow, 0] = rowHeader;
                gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(
                    string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.NetWeight.Value));
            }
            // load weight
            gridSolution.Rows.Insert(++iRow);
            rowHeader = new SourceGrid.Cells.RowHeader(
                string.Format(Resources.ID_LOADWEIGHT_WU, UnitsManager.MassUnitString))
            {
                View = vPropValue
            };
            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 = vPropValue
            };
            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 = vPropValue
            };
            gridSolution[iRow, 0] = rowHeader;
            gridSolution[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
                gridSolution.Rows.Insert(++iRow);
                rowHeader = new SourceGrid.Cells.RowHeader(_solution.LayerCaption(i))
                {
                    ColumnSpan = 2,
                    View       = vPropCaption
                };
                gridSolution[iRow, 0] = rowHeader;

                // *** Item # (recursive count)
                RecurInsertContent(ref iRow, _analysis.Content, _solution.LayerBoxCount(i));
                // ***

                // layer weight
                gridSolution.Rows.Insert(++iRow);
                rowHeader = new SourceGrid.Cells.RowHeader(string.Format(Resources.ID_WEIGHT_WU, UnitsManager.MassUnitString))
                {
                    View = vPropValue
                };
                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(string.Format(Resources.ID_SPACES_WU, UnitsManager.LengthUnitString))
                {
                    View = vPropValue
                };
                gridSolution[iRow, 0] = rowHeader;
                gridSolution[iRow, 1] = new SourceGrid.Cells.Cell(
                    string.Format(CultureInfo.InvariantCulture, "{0:0.#}", _solution.LayerMaximumSpace(i)));
            }

            gridSolution.AutoSizeCells();
            gridSolution.Columns.StretchToFit();
            gridSolution.AutoStretchColumnsToFitWidth = true;
            gridSolution.Invalidate();
        }
Пример #22
0
        private void PopulateGrid()
        {
            if (grid1.IsDisposed)
            {
                return;
            }

            Cell colTitleModel = new Cell
            {
                ElementText   = new ActorsGrid.RotatedText(-90.0f),
                BackColor     = Color.SteelBlue,
                ForeColor     = Color.White,
                TextAlignment = ContentAlignment.BottomCenter
            };

            Cell topleftTitleModel = new Cell
            {
                BackColor     = Color.SteelBlue,
                ForeColor     = Color.White,
                TextAlignment = ContentAlignment.BottomLeft
            };

            grid1.Columns.Clear();
            grid1.Rows.Clear();

            int maxSeason = GetMaxSeason(showList);

            int cols = maxSeason + 3;
            int rows = showList.Count + 1;

            // Draw Header
            grid1.ColumnsCount = cols;
            grid1.RowsCount    = rows;
            grid1.FixedColumns = 2;
            grid1.FixedRows    = 1;
            grid1.Selection.EnableMultiSelection = false;

            grid1.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize;
            grid1.Rows[0].Height       = 65;

            ColumnHeader h = new ColumnHeader("Show")
            {
                AutomaticSortEnabled = false,
                ResizeEnabled        = false
            };

            grid1[0, 0]      = h;
            grid1[0, 0].View = topleftTitleModel;

            ColumnHeader h2 = new ColumnHeader("Status")
            {
                AutomaticSortEnabled = false,
                ResizeEnabled        = false
            };

            grid1[0, 1]      = h2;
            grid1[0, 1].View = topleftTitleModel;

            // Draw season
            for (int c = chkHideSpecials.Checked?1:0; c < maxSeason + 1; c++)
            {
                h = new ColumnHeader(ProcessedSeason.UIFullSeasonWord(c))
                {
                    AutomaticSortEnabled = false,
                    ResizeEnabled        = false
                };

                grid1[0, c + 2]      = h;
                grid1[0, c + 2].View = colTitleModel;

                grid1.Columns[c + 2].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            }

            grid1.Columns[0].Width = 150;

            // Draw Shows

            int r = 0;

            foreach (ShowSummaryData show in showList)
            {
                //Ignore shows with no missing episodes
                if (chkHideComplete.Checked && !show.HasMssingEpisodes(chkHideSpecials.Checked, chkHideIgnored.Checked))
                {
                    continue;
                }

                //Ignore shows with no missing aired episodes
                if (chkHideUnaired.Checked && !show.HasAiredMssingEpisodes(chkHideSpecials.Checked, chkHideIgnored.Checked))
                {
                    continue;
                }

                //Ignore shows which do not have the missing check
                if (chkHideNotScanned.Checked && !show.ShowConfiguration.DoMissingCheck)
                {
                    continue;
                }

                if (chkOnlyShowEnded.Checked &&
                    !show.ShowConfiguration.ShowStatus.Equals("Ended", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                if (chkHideDiskEps.Checked && show.HasEpisodesOnDisk())
                {
                    continue;
                }

                RowHeader rh = new RowHeader(show.ShowName)
                {
                    ResizeEnabled = false,
                    View          = new Cell {
                        ForeColor = show.ShowConfiguration.DoMissingCheck ? Color.Black : Color.Gray
                    }
                };

                //Gray if the show is not checked for missing episodes in the scan

                grid1[r + 1, 0] = rh;
                grid1[r + 1, 0].AddController(new ShowClickEvent(this, show.ShowConfiguration));

                RowHeader rh2 = new RowHeader(show.ShowConfiguration.ShowStatus)
                {
                    ResizeEnabled = false,
                    View          = new Cell {
                        ForeColor = show.ShowConfiguration.DoMissingCheck ? Color.Black : Color.Gray
                    }
                };

                //Gray if the show is not checked for missing episodes in the scan

                grid1[r + 1, 1] = rh2;

                foreach (ShowSummaryData.ShowSummarySeasonData seasonData in show.SeasonDataList)
                {
                    ShowSummaryData.SummaryOutput output = seasonData.GetOuput();

                    //Ignore Season if checkbox is checked
                    if (chkHideSpecials.Checked && output.Special)
                    {
                        continue;
                    }

                    //Ignore Season if checkbox is checked
                    if (chkHideIgnored.Checked && output.Ignored)
                    {
                        continue;
                    }

                    grid1[r + 1, seasonData.SeasonNumber + 2] =
                        new SourceGrid.Cells.Cell(output.Details, typeof(string))
                    {
                        View = new Cell
                        {
                            BackColor     = output.Color,
                            ForeColor     = Color.White,
                            TextAlignment = ContentAlignment.BottomRight
                        },
                        Editor = { EditableMode = EditableMode.None }
                    };

                    grid1[r + 1, seasonData.SeasonNumber + 2].AddController(new ShowClickEvent(this, show.ShowConfiguration, seasonData.ProcessedSeason));
                }
                r++;
            }
            grid1.AutoSizeCells();
        }
        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());
            }
        }
Пример #24
0
		private void btLoad_Click(object sender, System.EventArgs e)
		{
			using (var counter = new PerformanceCounter())
			{
				grid.Redim(0, 0);
				//Visual properties shared between all the cells
				SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
				view.BackColor = Color.Snow;

				//Editor (IDataModel) shared between all the cells
				SourceGrid.Cells.Editors.TextBox editor = new
					SourceGrid.Cells.Editors.TextBox(typeof(string));

				grid.Redim(int.Parse(txtRows.Text), int.Parse(txtCols.Text));

				if (chkAddHeaders.Checked && grid.RowsCount > 0 &&
				    grid.ColumnsCount > 0)
				{
					grid.FixedRows = 1;
					grid.FixedColumns = 1;

					for (int r = grid.FixedRows; r < grid.RowsCount; r++)
						grid[r, 0] = new SourceGrid.Cells.RowHeader(r);

					for (int c = grid.FixedColumns; c < grid.ColumnsCount; c++)
					{
						SourceGrid.Cells.ColumnHeader header = new
							SourceGrid.Cells.ColumnHeader(c);
						header.AutomaticSortEnabled = false;
						grid[0, c] = header;
					}
					grid[0, 0] = new SourceGrid.Cells.Header();
				}
				else
				{
					grid.FixedRows = 0;
					grid.FixedColumns = 0;
				}

				for (int r = grid.FixedRows; r < grid.RowsCount; r++)
					for (int c = grid.FixedColumns; c < grid.ColumnsCount; c++)
				{
					grid[r, c] = new SourceGrid.Cells.Cell(r.ToString() + "," +
					                                       c.ToString());
					grid[r, c].Editor = editor;
					grid[r, c].View = view;
					var span = 3;
					if (chkAddColspan.Checked && (c + span < grid.ColumnsCount))
					{
						if (r % 2 == 0)
						{
							grid[r, c].ColumnSpan = span;
							c += span;
						}
					}
				}
				grid.Selection.Focus(new SourceGrid.Position(0, 0), true);
				this.toolStripStatusLabelBuildTime.Text = string.Format(
					"Rows added in {0} ms", counter.GetMilisec());
			}
		}
Пример #25
0
        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());
            }
        }
        private void GUI_Check_List_Load(object sender, EventArgs e)
        {
            //useless corner tile
            checksGrid.Columns.Insert(0);
            checksGrid.Rows.Insert(0);

            //columns
            checksGrid.Columns.Insert(0);
            checksGrid.Columns.Insert(0);
            checksGrid.Columns.Insert(0);

            //add rows
            foreach (Check c in _getChecks())
            {
                checksGrid.Rows.Insert(0);
                SourceGrid.Cells.Views.Cell rowView = new SourceGrid.Cells.Views.Cell();
                SourceGrid.Cells.Views.CheckBox checkView = new SourceGrid.Cells.Views.CheckBox();

                System.Drawing.Color cellColour;
                if (c.IsTriggered())
                {
                    cellColour = System.Drawing.Color.Red;
                }
                else if (c.HasError())
                {
                    cellColour = System.Drawing.Color.Yellow;
                }
                else if (c.IsPaused())
                {
                    cellColour = System.Drawing.Color.LightBlue;
                }
                else
                {
                    cellColour = System.Drawing.Color.White;
                }

                rowView.BackColor = cellColour;
                checkView.BackColor = cellColour;

                checksGrid[1, 0] = new SourceGrid.Cells.RowHeader(c.GetIndex());
                checksGrid[1, 1] = new SourceGrid.Cells.Cell(c.GetCheckType());
                checksGrid[1, 1].View = rowView;
                checksGrid[1, 2] = new SourceGrid.Cells.Cell(c.GetLocation());
                checksGrid[1, 2].View = rowView;
                SourceGrid.Cells.CheckBox pauseBox = new SourceGrid.Cells.CheckBox();
                pauseBox.Checked = c.IsPaused();

                checksGrid[1, 3] = pauseBox;
                checksGrid[1, 3].View = checkView;

            }

            //add column headers
            checksGrid[0, 1] = new SourceGrid.Cells.ColumnHeader("Name");
            checksGrid[0, 2] = new SourceGrid.Cells.ColumnHeader("Location");
            checksGrid[0, 3] = new SourceGrid.Cells.ColumnHeader("Paused");

            checksGrid.AutoSizeCells();
        }
        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();
        }
Пример #28
0
 public void DoFullTab1_frez()
 {
     #region SQLite Connection
     sqlite_conn = new SQLiteConnection("Data Source=databaseF.sqlite;Version=3;New=True;Compress=True;"); // create a new databaseF connection
     sqlite_conn.Open();                                                                                   // open the connection:
     sqlite_cmd             = sqlite_conn.CreateCommand();                                                 // create a new SQL command
     sqlite_cmd.CommandText = "SELECT * FROM FrEmpParamV";                                                 // First lets build a SQL-Query again
     sqlite_datareader      = sqlite_cmd.ExecuteReader();                                                  // The SQLiteDataReader allows us to run through the result lines
     #endregion
     #region Код таблицы 1 (твердый сплав)
     grid1Frez.BorderStyle = BorderStyle.FixedSingle;
     grid1Frez.Redim(15, 11);
     //заголовок
     grid1Frez[0, 0]  = new SourceGrid.Cells.ColumnHeader("Вид обработки");
     grid1Frez[0, 1]  = new SourceGrid.Cells.ColumnHeader("Материал резца");
     grid1Frez[0, 2]  = new SourceGrid.Cells.ColumnHeader("t");
     grid1Frez[0, 3]  = new SourceGrid.Cells.ColumnHeader("Sz");
     grid1Frez[0, 4]  = new SourceGrid.Cells.ColumnHeader("Cv");
     grid1Frez[0, 5]  = new SourceGrid.Cells.ColumnHeader("q");
     grid1Frez[0, 6]  = new SourceGrid.Cells.ColumnHeader("x");
     grid1Frez[0, 7]  = new SourceGrid.Cells.ColumnHeader("y");
     grid1Frez[0, 8]  = new SourceGrid.Cells.ColumnHeader("u");
     grid1Frez[0, 9]  = new SourceGrid.Cells.ColumnHeader("p");
     grid1Frez[0, 10] = new SourceGrid.Cells.ColumnHeader("m");
     grid1Frez[1, 0]  = new SourceGrid.Cells.ColumnHeader("Сталь углеродистая");
     grid1Frez[1, 0].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
     grid1Frez[1, 0].ColumnSpan         = 11;
     //строка 2
     grid1Frez[2, 0]            = new SourceGrid.Cells.RowHeader("Торцевое \nфрезерование");
     grid1Frez[2, 0].RowSpan    = 2;
     grid1Frez[4, 0]            = new SourceGrid.Cells.RowHeader("Боковое \nфрезерование");
     grid1Frez[4, 0].RowSpan    = 4;
     grid1Frez[8, 0]            = new SourceGrid.Cells.ColumnHeader("Чугун");
     grid1Frez[8, 0].ColumnSpan = 11;
     //строка 2
     grid1Frez[9, 0]          = new SourceGrid.Cells.RowHeader("Торцевое \nфрезерование");
     grid1Frez[9, 0].RowSpan  = 2;
     grid1Frez[11, 0]         = new SourceGrid.Cells.RowHeader("Боковое \nфрезерование");
     grid1Frez[11, 0].RowSpan = 4;
     for (int r = 2; r < 8; r++)
     {
         //grid1.Rows.Insert(r);
         if (sqlite_datareader.Read())
         {
             grid1Frez[r, 1]  = new SourceGrid.Cells.RowHeader(Convert.ToString(sqlite_datareader.GetString(0)));
             grid1Frez[r, 2]  = new SourceGrid.Cells.RowHeader(Convert.ToString(sqlite_datareader.GetString(1)));
             grid1Frez[r, 3]  = new SourceGrid.Cells.RowHeader(Convert.ToString(sqlite_datareader.GetString(2)));
             grid1Frez[r, 4]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(3)), typeof(float));
             grid1Frez[r, 5]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(4)), typeof(float));
             grid1Frez[r, 6]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(5)), typeof(float));
             grid1Frez[r, 7]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(6)), typeof(float));
             grid1Frez[r, 8]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(7)), typeof(float));
             grid1Frez[r, 9]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(8)), typeof(float));
             grid1Frez[r, 10] = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(9)), typeof(float));
         }
         for (int c = 4; c < 11; c++)
         {
             grid1Frez[r, c].AddController(clickEvent);              //клик мыши
             grid1Frez[r, c].AddController(rowpointer);              //наведение
             grid1Frez[r, c].Editor.EnableEdit = false;              //нередактируемые ячейки
             grid1Frez[r, c].AddController(new SourceGrid.Cells.Controllers.Unselectable());
             grid1Frez[r, c].AddController(new MyHelpRowTracking()); //help row pointer
         }
     }
     for (int r = 9; r < 15; r++)
     {
         if (sqlite_datareader.Read())
         {
             grid1Frez[r, 1]  = new SourceGrid.Cells.RowHeader(Convert.ToString(sqlite_datareader.GetString(0)));
             grid1Frez[r, 2]  = new SourceGrid.Cells.RowHeader(Convert.ToString(sqlite_datareader.GetString(1)));
             grid1Frez[r, 3]  = new SourceGrid.Cells.RowHeader(Convert.ToString(sqlite_datareader.GetString(2)));
             grid1Frez[r, 4]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(3)), typeof(float));
             grid1Frez[r, 5]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(4)), typeof(float));
             grid1Frez[r, 6]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(5)), typeof(float));
             grid1Frez[r, 7]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(6)), typeof(float));
             grid1Frez[r, 8]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(7)), typeof(float));
             grid1Frez[r, 9]  = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(8)), typeof(float));
             grid1Frez[r, 10] = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(9)), typeof(float));
         }
         for (int c = 4; c < 11; c++)
         {
             grid1Frez[r, c].AddController(clickEvent);              //клик мыши
             grid1Frez[r, c].AddController(rowpointer);              //наведение
             grid1Frez[r, c].Editor.EnableEdit = false;              //нередактируемые ячейки
             grid1Frez[r, c].AddController(new SourceGrid.Cells.Controllers.Unselectable());
             grid1Frez[r, c].AddController(new MyHelpRowTracking()); //help row pointer
         }
     }
     grid1Frez.AutoSizeCells();
     grid1Frez.EnableSort = false;
     grid1Frez.Selection.EnableMultiSelection = false;
     sqlite_conn.Close();
     #endregion
 }
Пример #29
0
        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());
            }
        }
Пример #30
0
		private void brAddRow_Click(object sender, System.EventArgs e)
		{
            int row = grid1.RowsCount;
			grid1.Rows.Insert(row);

            grid1[row, 0] = new SourceGrid.Cells.RowHeader(null);
            grid1[row, 1] = new SourceGrid.Cells.Cell(grid1.RowsCount, mEditor_Id);
			grid1[row, 2] = new SourceGrid.Cells.Cell(mEditor_Name.DefaultValue, mEditor_Name);
			grid1[row, 3] = new SourceGrid.Cells.Cell(mEditor_Address.DefaultValue,mEditor_Address);
			grid1[row, 4] = new SourceGrid.Cells.Cell(mEditor_City.DefaultValue,mEditor_City);
			grid1[row, 5] = new SourceGrid.Cells.Cell(mEditor_BirthDay.DefaultValue, mEditor_BirthDay);
			grid1[row, 6] = new SourceGrid.Cells.Cell(mEditor_Country.DefaultValue, mEditor_Country);
			grid1[row, 7] = new SourceGrid.Cells.Cell(mEditor_Price.DefaultValue, mEditor_Price);
			grid1[row, 8] = new SourceGrid.Cells.CheckBox(null, false);

            SourceGrid.Cells.Link link = new SourceGrid.Cells.Link("http://www.codeproject.com");
            link.AddController(mController_Link);
            grid1[row, 9] = link;

            grid1.Selection.FocusRow(row);
		}
Пример #31
0
		private void frmSample17_Load(object sender, System.EventArgs e)
		{
			grid1.Redim(40,40);
            grid1.FixedColumns = 1;
            grid1.FixedRows = 1;

			grid1[0,0] = new SourceGrid.Cells.Header(null);
			for (int c = 1; c < grid1.ColumnsCount; c++)
			{
				SourceGrid.Cells.ColumnHeader header = new SourceGrid.Cells.ColumnHeader("Header " + c.ToString());
                header.AutomaticSortEnabled = false;

                //header.ColumnSelectorEnabled = true;
                //header.ColumnFocusEnabled = true;

                grid1[0, c] = header;
			}

			Random rnd = new Random();
			for (int r = 1; r < grid1.RowsCount; r++)
			{
				grid1[r,0] = new SourceGrid.Cells.RowHeader("Header " + r.ToString());
				for (int c = 1; c < grid1.ColumnsCount; c++)
				{
					if (rnd.NextDouble() > 0.20)
					{
						grid1[r,c] = new SourceGrid.Cells.Cell(r*c, typeof(int));
					}
					else
						grid1[r,c] = null;
				}
			}

			cPickSelBackColor.SelectedColor = Color.FromArgb(grid1.Selection.BackColor.R, grid1.Selection.BackColor.G, grid1.Selection.BackColor.B);
			cPckBorderColor.SelectedColor = grid1.Selection.Border.Top.Color;
			trackSelectionAlpha.Value = (int)grid1.Selection.BackColor.A;
			trackBorderWidth.Value = (int)grid1.Selection.Border.Top.Width;

			cPickFocusBackColor.SelectedColor = Color.FromArgb(grid1.Selection.FocusBackColor.R, grid1.Selection.FocusBackColor.G, grid1.Selection.FocusBackColor.B);
			trackFocusBackColorTrans.Value = grid1.Selection.FocusBackColor.A;


			this.cPickSelBackColor.SelectedColorChanged += new System.EventHandler(this.cPickSelBackColor_SelectedColorChanged);
			this.cPckBorderColor.SelectedColorChanged += new System.EventHandler(this.cPckBorderColor_SelectedColorChanged);
			this.trackSelectionAlpha.ValueChanged += new System.EventHandler(this.trackSelectionAlpha_ValueChanged);
			this.trackBorderWidth.ValueChanged += new System.EventHandler(this.trackBorderWidth_ValueChanged);
			this.trackFocusBackColorTrans.ValueChanged += new System.EventHandler(this.trackFocusBackColorTrans_ValueChanged);
			this.cPickFocusBackColor.SelectedColorChanged += new System.EventHandler(this.cPickFocusBackColor_SelectedColorChanged);

			cbDashStyle.Validator = new DevAge.ComponentModel.Validator.ValidatorTypeConverter(typeof(System.Drawing.Drawing2D.DashStyle));
			cbDashStyle.Value = grid1.Selection.Border.Top.DashStyle;
		}
Пример #32
0
        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());
            }
        }
Пример #33
0
        private void btLoad_Click(object sender, System.EventArgs e)
        {
            grid.Redim(0, 0);
            //Visual properties shared between all the cells
            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
            view.BackColor = Color.Snow;

            //Editor (IDataModel) shared between all the cells
            SourceGrid.Cells.Editors.TextBox editor = new
            SourceGrid.Cells.Editors.TextBox(typeof(string));

            grid.Redim(int.Parse(txtRows.Text), int.Parse(txtCols.Text));

            if (chkAddHeaders.Checked && grid.RowsCount > 0 &&
                        grid.ColumnsCount > 0)
            {
                grid.FixedRows = 1;
                grid.FixedColumns = 1;

                for (int r = grid.FixedRows; r < grid.RowsCount; r++)
                    grid[r, 0] = new SourceGrid.Cells.RowHeader(r);
                for (int c = grid.FixedColumns; c < grid.ColumnsCount; c++)
                {
                    SourceGrid.Cells.ColumnHeader header = new
                    SourceGrid.Cells.ColumnHeader(c);
                    header.AutomaticSortEnabled = false;
                    grid[0, c] = header;
                }
                grid[0, 0] = new SourceGrid.Cells.Header();
            }
            else
            {
                grid.FixedRows = 0;
                grid.FixedColumns = 0;
            }

            for (int r = grid.FixedRows; r < grid.RowsCount; r++)
                for (int c = grid.FixedColumns; c < grid.ColumnsCount; c++)
                {
                    grid[r, c] = new SourceGrid.Cells.Cell(r.ToString() + "," +
                    c.ToString());
                    grid[r, c].Editor = editor;
                    grid[r, c].View = view;
                }
            grid.Selection.Focus(new SourceGrid.Position(0, 0), true);
        }
Пример #34
0
        protected virtual void BindToViewModel()
        {
            ClearSelection();
            if (ViewModel == null)
            {
                _grid.Redim(0, 0);
                return;
            }
            var dataSourceRowCount = ViewModel.GetRowCount();
            var dataSourceColCount = ViewModel.GetColumnCount();
            var colIndexOffset     = HasRowHeaders ? 2 : 0;
            var rowIndexOffset     = HasColHeaders ? 1 : 0;

            _grid.Redim(dataSourceRowCount + rowIndexOffset, dataSourceColCount + colIndexOffset);
            for (int i = 0; i < _grid.ColumnsCount; i++)
            {
                if (this.MaxColumnWidth > 0)
                {
                    _grid.Columns[i].MaximalWidth = this.MaxColumnWidth;
                }
                if (this.MinColumnWidth > 0)
                {
                    _grid.Columns[i].MinimalWidth = this.MinColumnWidth;
                }
                _grid.Columns[i].AutoSizeMode = SourceGrid.AutoSizeMode.EnableStretch;
            }
            var rowHeaders = (
                from rowNumber in Enumerable.Range(0, dataSourceRowCount)
                select ViewModel.GetRowHeaderText(rowNumber)
                ).ToLookup(x => x.Item1, x => x.Item2);

            if (HasRowHeaders)
            {
                for (int i = 0; i < _grid.RowsCount; i++)
                {
                    _grid[i, 0] = _grid[i, 1] = null;
                }

                _grid[0, 0]            = new SourceGrid.Cells.Header("Time");
                _grid[0, 0].ColumnSpan = 2;

                _grid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.None;
                _grid.Columns[0].MinimalWidth = 0;
                _grid.Columns[0].MaximalWidth = RowHeaderColumnWidth;
                _grid.Columns[0].Width        = RowHeaderColumnWidth;

                _grid.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.None;
                _grid.Columns[1].MinimalWidth = 0;
                _grid.Columns[1].MaximalWidth = RowHeaderColumnWidth;
                _grid.Columns[1].Width        = RowHeaderColumnWidth;

                var rowIndex = rowIndexOffset;
                foreach (var rowHeader in rowHeaders)
                {
                    _grid[rowIndex, 0] = new SourceGrid.Cells.RowHeader(rowHeader.Key)
                    {
                        RowSpan = rowHeader.Count()
                    };
                    foreach (var secondRowHeader in rowHeader)
                    {
                        var secondRowHeaderCell = new SourceGrid.Cells.RowHeader(secondRowHeader);
                        secondRowHeaderCell.View = new SuperscriptRowHeaderCellView();
                        _grid[rowIndex, 1]       = secondRowHeaderCell;
                        rowIndex++;
                    }
                }
            }

            if (HasColHeaders)
            {
                for (var i = 0 + colIndexOffset; i < _grid.ColumnsCount; i++)
                {
                    _grid[0, i] = null;
                }

                for (var dataColIndex = 0; dataColIndex < dataSourceColCount; dataColIndex++)
                {
                    _grid[0, dataColIndex + colIndexOffset] = new SourceGrid.Cells.Header(_viewModel.GetColumnHeaderText(dataColIndex));
                }
            }

            for (var row = 0; row < dataSourceRowCount; row++)
            {
                for (var col = 0; col < dataSourceColCount; col++)
                {
                    var cellDisplay = _viewModel.GetCellDisplay(col, row);
                    var cell        = new SourceGrid.Cells.Cell(cellDisplay.Text);
                    if (cellDisplay.Traits.HasFlag(CellTraits.Empty))
                    {
                        BindEmptyCell(cell, cellDisplay, col, row);
                    }
                    else
                    {
                        BindCellWithCellDisplay(cell, cellDisplay, col, row);
                    }
                    _cellDisplays[Tuple.Create(col, row)] = Tuple.Create(cell, cellDisplay);
                    cellDisplay.GridCellObject            = cell;
                    var gridRow = row;
                    var gridCol = col;
                    TransformModelToGrid(ref gridCol, ref gridRow);
                    _grid[gridRow, gridCol] = cell;
                }
            }
            _grid.PerformResize();
        }
Пример #35
0
        public virtual void UpdateGrid()
        {
            try
            {
                // remove all existing rows
                gridSolution.Rows.Clear();

                // cell visual properties
                var vPropHeader = CellProperties.VisualPropHeader;
                var vPropValue  = CellProperties.VisualPropValue;

                SourceGrid.Cells.RowHeader rowHeader;
                int iRow = -1;

                // loading caption
                gridSolution.Rows.Insert(++iRow);
                rowHeader = new SourceGrid.Cells.RowHeader(GridCaption)
                {
                    ColumnSpan = 2,
                    View       = vPropHeader
                };
                gridSolution[iRow, 0] = rowHeader;
                // layer #
                gridSolution.Rows.Insert(++iRow);
                rowHeader = new SourceGrid.Cells.RowHeader(Resources.ID_LAYERCOUNT)
                {
                    View = vPropValue
                };
                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_INTERLAYERCOUNT)
                    {
                        View = vPropValue
                    };
                    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))
                    {
                        View = vPropValue
                    };
                    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 = vPropValue
                };
                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 = vPropValue
                    };
                    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 = vPropValue
                };
                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 = vPropValue
                };
                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 = vPropValue
                };
                gridSolution[iRow, 0] = rowHeader;
                gridSolution[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
                    gridSolution.Rows.Insert(++iRow);
                    rowHeader = new SourceGrid.Cells.RowHeader(_solution.LayerCaption(i))
                    {
                        ColumnSpan = 2,
                        View       = vPropHeader
                    };
                    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))
                        {
                            View = vPropValue
                        };
                        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))
                    {
                        View = vPropValue
                    };
                    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(string.Format(Resources.ID_SPACES_WU, UnitsManager.LengthUnitString))
                    {
                        View = vPropValue
                    };
                    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());
            }
        }
Пример #36
0
		private void frmSampleGrid1_Load(object sender, System.EventArgs e)
		{
			string[] l_CountryList = new string[]{"Italy","France","Spain","UK","Argentina","Mexico", "Switzerland", "Brazil", "Germany","Portugal","Sweden","Austria"};

			grid1.RowsCount = 1;
			grid1.ColumnsCount = 10;
			grid1.FixedRows = 1;
			grid1.FixedColumns = 1;
			grid1.SelectionMode = SourceGrid.GridSelectionMode.Row;
			grid1.AutoStretchColumnsToFitWidth = true;
			grid1.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.None;
			grid1.Columns[0].Width = 25;

            grid1.Controller.AddController(new KeyDeleteController());
		
            //TODO
            ////Enable Drag and Drop
            //grid1.GridController.AddController(SourceGrid.Controllers.SelectionDrag.Cut);
            //grid1.GridController.AddController(SourceGrid.Controllers.SelectionDrop.Default);


			#region Create Grid Style, Views and Controllers
			//Views
			mView_Price = new SourceGrid.Cells.Views.Cell();
			mView_Price.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight;


			mController_Link = new SourceGrid.Cells.Controllers.Button();
			mController_Link.Executed += new EventHandler(mController_Link_Click);
			#endregion

			#region Create Header Row and Editor
			SourceGrid.Cells.Header l_00Header = new SourceGrid.Cells.Header(null);
			grid1[0,0] = l_00Header;

            mEditor_Id = SourceGrid.Cells.Editors.Factory.Create(typeof(int));
			mEditor_Id.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick;
			grid1[0,1] = new SourceGrid.Cells.ColumnHeader("ID (int)");

            mEditor_Name = SourceGrid.Cells.Editors.Factory.Create(typeof(string));
			mEditor_Name.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick;
			grid1[0,2] = new SourceGrid.Cells.ColumnHeader("NAME (string)");

            mEditor_Address = SourceGrid.Cells.Editors.Factory.Create(typeof(string));
			mEditor_Address.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick;
			grid1[0,3] = new SourceGrid.Cells.ColumnHeader("ADDRESS (string)");

            mEditor_City = SourceGrid.Cells.Editors.Factory.Create(typeof(string));
			mEditor_City.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick;
			grid1[0,4] = new SourceGrid.Cells.ColumnHeader("CITY (string)");

			mEditor_BirthDay = SourceGrid.Cells.Editors.Factory.Create(typeof(DateTime));
			mEditor_BirthDay.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick;
			grid1[0,5] = new SourceGrid.Cells.ColumnHeader("BIRTHDATE (DateTime)");

			mEditor_Country = new SourceGrid.Cells.Editors.ComboBox(typeof(string),l_CountryList,false);
			mEditor_Country.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick;
			grid1[0,6] = new SourceGrid.Cells.ColumnHeader("COUNTRY (string + combobox)");

			mEditor_Price = new SourceGrid.Cells.Editors.TextBoxCurrency(typeof(double));
			mEditor_Price.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick;
			grid1[0,7] = new SourceGrid.Cells.ColumnHeader("$ PRICE (double)");

			grid1[0,8] = new SourceGrid.Cells.ColumnHeader("Selected");

			grid1[0,9] = new SourceGrid.Cells.ColumnHeader("WebSite");
			#endregion

			//Read Data From xml
			System.IO.StreamReader reader = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsFormsSample.GridSamples.SampleData.xml"));
			System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
			xmlDoc.LoadXml(reader.ReadToEnd());
			reader.Close();
			System.Xml.XmlNodeList rows = xmlDoc.SelectNodes("//row");
			grid1.RowsCount = rows.Count+1;
			int rowsCount = 1;
			foreach(System.Xml.XmlNode l_Node in rows)
			{
				#region Pupulate RowsCount
				grid1[rowsCount,0] = new SourceGrid.Cells.RowHeader(null);

				grid1[rowsCount,1] = new SourceGrid.Cells.Cell(rowsCount, mEditor_Id);

				grid1[rowsCount,2] = new SourceGrid.Cells.Cell(l_Node.Attributes["ContactName"].InnerText, mEditor_Name);

				grid1[rowsCount,3] = new SourceGrid.Cells.Cell(l_Node.Attributes["Address"].InnerText, mEditor_Address);

				grid1[rowsCount,4] = new SourceGrid.Cells.Cell(l_Node.Attributes["City"].InnerText, mEditor_City);

				grid1[rowsCount,5] = new SourceGrid.Cells.Cell(DateTime.Today, mEditor_BirthDay);

				grid1[rowsCount,6] = new SourceGrid.Cells.Cell(l_Node.Attributes["Country"].InnerText, mEditor_Country);

				grid1[rowsCount,7] = new SourceGrid.Cells.Cell(25.0, mEditor_Price);
                grid1[rowsCount, 7].View = mView_Price;

				grid1[rowsCount,8] = new SourceGrid.Cells.CheckBox(null, false);

				grid1[rowsCount,9] = new SourceGrid.Cells.Link(l_Node.Attributes["website"].InnerText);
				grid1[rowsCount,9].AddController(mController_Link);
				#endregion

				rowsCount++;
			}

            grid1.AutoSizeCells();
		}
Пример #37
0
        public void PopulateGrid()
        {
            Cell colTitleModel = new Cell
            {
                ElementText   = new ActorsGrid.RotatedText(-90.0f),
                BackColor     = Color.SteelBlue,
                ForeColor     = Color.White,
                TextAlignment = ContentAlignment.BottomCenter
            };

            Cell topleftTitleModel = new Cell
            {
                BackColor     = Color.SteelBlue,
                ForeColor     = Color.White,
                TextAlignment = ContentAlignment.BottomLeft
            };

            this.grid1.Columns.Clear();
            this.grid1.Rows.Clear();

            int maxSeason = GetMaxSeason(showList);

            int cols = maxSeason + 2;
            int rows = showList.Count + 1;

            // Draw Header
            this.grid1.ColumnsCount = cols;
            this.grid1.RowsCount    = rows;
            this.grid1.FixedColumns = 1;
            this.grid1.FixedRows    = 1;
            this.grid1.Selection.EnableMultiSelection = false;

            this.grid1.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize;
            this.grid1.Rows[0].Height       = 65;

            ColumnHeader h = new ColumnHeader("Show")
            {
                AutomaticSortEnabled = false,
                ResizeEnabled        = false
            };

            this.grid1[0, 0]      = h;
            this.grid1[0, 0].View = topleftTitleModel;

            // Draw season
            for (int c = 0; c < maxSeason + 1; c++)
            {
                h = new ColumnHeader(c == 0 ? "Specials" : $"Season {c}")
                {
                    AutomaticSortEnabled = false,
                    ResizeEnabled        = false
                };

                this.grid1[0, c + 1]      = h;
                this.grid1[0, c + 1].View = colTitleModel;

                this.grid1.Columns[c + 1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            }

            this.grid1.Columns[0].Width = 150;

            // Draw Shows

            int r = 0; // TODO: remove reliance on index

            foreach (ShowSummaryData show in showList)
            {
                RowHeader rh = new RowHeader(show.ShowName)
                {
                    ResizeEnabled = false
                };

                this.grid1[r + 1, 0] = rh;
                this.grid1[r + 1, 0].AddController(new ShowClickEvent(this, show.ShowItem));

                foreach (ShowSummaryData.ShowSummarySeasonData seasonData in show.SeasonDataList)
                {
                    ShowSummaryData.SummaryOutput output = seasonData.GetOuput();
                    this.grid1[r + 1, seasonData.SeasonNumber + 1]      = new SourceGrid.Cells.Cell(output.Details, typeof(string));
                    this.grid1[r + 1, seasonData.SeasonNumber + 1].View = new Cell
                    {
                        BackColor     = output.Color,
                        ForeColor     = Color.White,
                        TextAlignment = ContentAlignment.BottomRight
                    };
                    this.grid1[r + 1, seasonData.SeasonNumber + 1].AddController(new ShowClickEvent(this, show.ShowItem, seasonData.Season));
                    this.grid1[r + 1, seasonData.SeasonNumber + 1].Editor.EditableMode = EditableMode.None;
                }
                r++;
            }
            this.grid1.AutoSizeCells();
        }
Пример #38
0
        private void frmSampleGrid1_Load(object sender, System.EventArgs e)
        {
            string[] l_CountryList = new string[] { "Italy", "France", "Spain", "UK", "Argentina", "Mexico", "Switzerland", "Brazil", "Germany", "Portugal", "Sweden", "Austria" };

            grid1.RowsCount     = 1;
            grid1.ColumnsCount  = 10;
            grid1.FixedRows     = 1;
            grid1.FixedColumns  = 1;
            grid1.SelectionMode = SourceGrid.GridSelectionMode.Row;
            grid1.AutoStretchColumnsToFitWidth = true;
            grid1.Columns[0].AutoSizeMode      = SourceGrid.AutoSizeMode.None;
            grid1.Columns[0].Width             = 25;

            grid1.Controller.AddController(new KeyDeleteController());

            //TODO
            ////Enable Drag and Drop
            //grid1.GridController.AddController(SourceGrid.Controllers.SelectionDrag.Cut);
            //grid1.GridController.AddController(SourceGrid.Controllers.SelectionDrop.Default);


            #region Create Grid Style, Views and Controllers
            //Views
            mView_Price = new SourceGrid.Cells.Views.Cell();
            mView_Price.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight;


            mController_Link           = new SourceGrid.Cells.Controllers.Button();
            mController_Link.Executed += new EventHandler(mController_Link_Click);
            #endregion

            #region Create Header Row and Editor
            SourceGrid.Cells.Header l_00Header = new SourceGrid.Cells.Header(null);
            grid1[0, 0] = l_00Header;

            mEditor_Id = SourceGrid.Cells.Editors.Factory.Create(typeof(int));
            mEditor_Id.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.AnyKey | SourceGrid.EditableMode.SingleClick;
            grid1[0, 1]             = new SourceGrid.Cells.ColumnHeader("ID (int)");

            mEditor_Name = SourceGrid.Cells.Editors.Factory.Create(typeof(string));
            mEditor_Name.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.AnyKey | SourceGrid.EditableMode.SingleClick;
            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("NAME (string)");

            mEditor_Address = SourceGrid.Cells.Editors.Factory.Create(typeof(string));
            mEditor_Address.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.AnyKey | SourceGrid.EditableMode.SingleClick;
            grid1[0, 3] = new SourceGrid.Cells.ColumnHeader("ADDRESS (string)");

            mEditor_City = SourceGrid.Cells.Editors.Factory.Create(typeof(string));
            mEditor_City.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.AnyKey | SourceGrid.EditableMode.SingleClick;
            grid1[0, 4] = new SourceGrid.Cells.ColumnHeader("CITY (string)");

            mEditor_BirthDay = SourceGrid.Cells.Editors.Factory.Create(typeof(DateTime));
            mEditor_BirthDay.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.AnyKey | SourceGrid.EditableMode.SingleClick;
            grid1[0, 5] = new SourceGrid.Cells.ColumnHeader("BIRTHDATE (DateTime)");

            mEditor_Country = new SourceGrid.Cells.Editors.ComboBox(typeof(string), l_CountryList, false);
            mEditor_Country.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.AnyKey | SourceGrid.EditableMode.SingleClick;
            grid1[0, 6] = new SourceGrid.Cells.ColumnHeader("COUNTRY (string + combobox)");

            mEditor_Price = new SourceGrid.Cells.Editors.TextBoxCurrency(typeof(double));
            mEditor_Price.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.AnyKey | SourceGrid.EditableMode.SingleClick;
            grid1[0, 7] = new SourceGrid.Cells.ColumnHeader("$ PRICE (double)");

            grid1[0, 8] = new SourceGrid.Cells.ColumnHeader("Selected");

            grid1[0, 9] = new SourceGrid.Cells.ColumnHeader("WebSite");
            #endregion

            //Read Data From xml
            System.IO.StreamReader reader = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsFormsSample.GridSamples.SampleData.xml"));
            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
            xmlDoc.LoadXml(reader.ReadToEnd());
            reader.Close();
            System.Xml.XmlNodeList rows = xmlDoc.SelectNodes("//row");
            grid1.RowsCount = rows.Count + 1;
            int rowsCount = 1;
            foreach (System.Xml.XmlNode l_Node in rows)
            {
                #region Pupulate RowsCount
                grid1[rowsCount, 0] = new SourceGrid.Cells.RowHeader(null);

                grid1[rowsCount, 1] = new SourceGrid.Cells.Cell(rowsCount, mEditor_Id);

                grid1[rowsCount, 2] = new SourceGrid.Cells.Cell(l_Node.Attributes["ContactName"].InnerText, mEditor_Name);

                grid1[rowsCount, 3] = new SourceGrid.Cells.Cell(l_Node.Attributes["Address"].InnerText, mEditor_Address);

                grid1[rowsCount, 4] = new SourceGrid.Cells.Cell(l_Node.Attributes["City"].InnerText, mEditor_City);

                grid1[rowsCount, 5] = new SourceGrid.Cells.Cell(DateTime.Today, mEditor_BirthDay);

                grid1[rowsCount, 6] = new SourceGrid.Cells.Cell(l_Node.Attributes["Country"].InnerText, mEditor_Country);

                grid1[rowsCount, 7]      = new SourceGrid.Cells.Cell(25.0, mEditor_Price);
                grid1[rowsCount, 7].View = mView_Price;

                grid1[rowsCount, 8] = new SourceGrid.Cells.CheckBox(null, false);

                grid1[rowsCount, 9] = new SourceGrid.Cells.Link(l_Node.Attributes["website"].InnerText);
                grid1[rowsCount, 9].AddController(mController_Link);
                #endregion

                rowsCount++;
            }

            grid1.AutoSizeCells();
        }