Exemplo n.º 1
0
        public void Reset(float[,] covar)
        {
            int x, y, n = covar.GetLength(0), m = covar.GetLength(1);

            grid.RowsCount    = m + 1;
            grid.ColumnsCount = n + 1;
            grid[0, 0]        = new SourceGrid2.Cells.Real.Header();
            for (x = 0; x < n; x++)
            {
                grid[0, x + 1] = new  SourceGrid2.Cells.Real.ColumnHeader(x + 1);
            }
            for (y = 0; y < m; y++)
            {
                grid[y + 1, 0] = new SourceGrid2.Cells.Real.RowHeader(y + 1);
            }
            for (x = 0; x < n; x++)
            {
                for (y = 0; y < m; y++)
                {
                    grid[x + 1, y + 1] = new SourceGrid2.Cells.Real.Cell(covar[x, y], typeof(double));
                    grid[x + 1, y + 1].DataModel.EnableEdit = false;
                }
            }
            grid.AutoSize();
        }
Exemplo n.º 2
0
        public void Reset(FunctionItem item)
        {
            this.item = item;


            grid.ColumnsCount = 2;
            grid.RowsCount    = item.p.Length + 1;
            grid[0, 0]        = new SourceGrid2.Cells.Real.Header("n");
            grid[0, 1]        = new SourceGrid2.Cells.Real.ColumnHeader("p[n]");
            for (int r = 0; r < item.p.Length; r++)
            {
                grid[r + 1, 0] = new SourceGrid2.Cells.Real.RowHeader(r);
                grid[r + 1, 1] = new SourceGrid2.Cells.Real.Cell(item.p[r], typeof(double));
            }

            grid.Columns[0].AutoSizeMode = SourceGrid2.AutoSizeMode.MinimumSize;
            grid.Columns[1].AutoSizeMode = SourceGrid2.AutoSizeMode.MinimumSize;
            grid.AutoSize();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Fills the Grid with Binary Data
        /// </summary>
        /// <param name="data">The data to fill into the Grid</param>
        /// <remarks>The Grid will be cleard before the fill</remarks>
        protected void FillGrid(Byte[] data)
        {
            hexgrid.RowsCount = 0;
            hexgrid.Rows.Insert(0);
            hexgrid[0, 0]                  = new SourceGrid2.Cells.Real.Cell("");
            hexgrid[0, 0].VisualModel      = new SourceGrid2.VisualModels.FlatHeader(true);
            hexgrid[0, 0].Grid.BorderStyle = BorderStyle.None;


            for (int i = 1; i < hexgrid.ColumnsCount; i++)
            {
                hexgrid[0, i]                  = new SourceGrid2.Cells.Real.Header(MinLen((i - 1).ToString("X"), 2, '0'));
                hexgrid[0, i].VisualModel      = new SourceGrid2.VisualModels.FlatHeader(true);
                hexgrid[0, i].Grid.BorderStyle = BorderStyle.None;
            }

            uint ct  = 0;
            int  row = 0;

            if (data != null)
            {
                while (ct < Math.Min(MaxSize, data.Length))
                {
                    int col = (int)(ct % (hexgrid.ColumnsCount - 1));
                    if (col == 0)
                    {
                        row++;
                        hexgrid.Rows.Insert(row);
                        hexgrid[row, 0]                  = new SourceGrid2.Cells.Real.Header("0x" + MinLen(ct.ToString("X").ToString(), 8, '0'));
                        hexgrid[row, 0].VisualModel      = new SourceGrid2.VisualModels.FlatHeader(true);
                        hexgrid[row, 0].Grid.BorderStyle = BorderStyle.None;
                    }
                    if ((data[ct] == 0) && (hide_00))
                    {
                        hexgrid[row, col + 1] = new SourceGrid2.Cells.Real.Cell("");
                    }
                    else
                    {
                        hexgrid[row, col + 1] = new SourceGrid2.Cells.Real.Cell(MinLen(data[ct].ToString("X"), 2, '0'));
                    }
                    hexgrid[row, col + 1].Grid.BorderStyle = BorderStyle.None;
                    ct++;
                }                 //while
            }

            hexgrid.AutoStretchColumnsToFitWidth = false;
            hexgrid.AutoSize();

            hexgrid.Width = 0;
            for (int i = 0; i < hexgrid.ColumnsCount; i++)
            {
                hexgrid.Columns[i].Width -= 10;
                if (((i % 4) == 0) && (i != 0))
                {
                    hexgrid.Columns[i].Width += 10;
                }
                hexgrid.Width += hexgrid.Columns[i].Width;
            }

            hexgrid.Height = 0;
            for (int i = 0; i < hexgrid.RowsCount; i++)
            {
                hexgrid.Rows[i].Height = 15;
                hexgrid.Height        += hexgrid.Rows[i].Height;
            }
        }
Exemplo n.º 4
0
		public void Reset(FunctionItem item) {
			this.item = item;


			grid.ColumnsCount = 2;
			grid.RowsCount = item.p.Length + 1;
			grid[0,0] = new SourceGrid2.Cells.Real.Header("n");
			grid[0,1] = new SourceGrid2.Cells.Real.ColumnHeader("p[n]");
			for (int r = 0; r < item.p.Length; r++) {
				grid[r+1,0] = new SourceGrid2.Cells.Real.RowHeader(r);
				grid[r+1,1] = new SourceGrid2.Cells.Real.Cell(item.p[r], typeof(double));
			}

			grid.Columns[0].AutoSizeMode = SourceGrid2.AutoSizeMode.MinimumSize;
			grid.Columns[1].AutoSizeMode = SourceGrid2.AutoSizeMode.MinimumSize;
			grid.AutoSize();
		}
Exemplo n.º 5
0
		public void Reset(float[,] covar) {
			int x, y, n = covar.GetLength(0), m = covar.GetLength(1);
			grid.RowsCount = m+1;
			grid.ColumnsCount = n+1;
			grid[0, 0] = new SourceGrid2.Cells.Real.Header();
			for (x = 0; x < n; x++) {
				grid[0, x+1] = new  SourceGrid2.Cells.Real.ColumnHeader(x+1);
			}
			for (y = 0; y < m; y++) {
				grid[y+1, 0] = new SourceGrid2.Cells.Real.RowHeader(y+1);
			}
			for (x = 0; x < n; x++) {
				for (y = 0; y < m; y++) {
					grid[x+1, y+1] = new SourceGrid2.Cells.Real.Cell(covar[x, y], typeof(double));
					grid[x+1, y+1].DataModel.EnableEdit = false;
				}
			}
			grid.AutoSize();
		}