private void InitializeIgnitionMap() { IgnitionMapDataGridView.Redim(11, 11); IgnitionMapDataGridView.FixedColumns = 1; IgnitionMapDataGridView.FixedRows = 1; IgnitionMapDataGridView[0, 0] = new SourceGrid.Cells.ColumnHeader(string.Empty) { View = emptyHeaderView }; IgnitionMapDataGridView[0, 0].Column.MinimalWidth = 80; IgnitionMapDataGridView[0, 0].Column.MaximalWidth = 200; IgnitionMapDataGridView[0, 0].Column.Width = 80; for (int rowIndex = 1; rowIndex < 11; rowIndex++) { IgnitionMapDataGridView[rowIndex, 0] = new LoadCell(Font, Controller.GlobalConfiguration.LoadTypeMaximum, (binIndex, value) => Controller.IgnitionMap.UpdateLoadBin(binIndex, value)); IgnitionMapDataGridView.Rows[rowIndex].Height = 28; for (int columnIndex = 1; columnIndex < IgnitionMapDataGridView.ColumnsCount; columnIndex++) { if (rowIndex == 1) { Cell rpmHeaderCellheader = new RpmCell(Font, (binIndex, value) => Controller.IgnitionMap.UpdateRpmBin(binIndex, value)); IgnitionMapDataGridView[0, columnIndex] = rpmHeaderCellheader; rpmHeaderCellheader.Column.MinimalWidth = 60; rpmHeaderCellheader.Column.Width = 60; rpmHeaderCellheader.View = columnHeaderView; } IgnitionMapDataGridView[rowIndex, columnIndex] = new AdvanceCell(Font, true, (row, col, value) => Controller.IgnitionMap[row, col] = unchecked ((byte)value)); } } IgnitionMapDataGridView.Width = 0; //This will force a resize so the columns will stretch to fill the space. The width will not actually be set to 0 because the Dock property is set to Fill. }
private void CreateHeaders(ResultSet resultSet) { var headerView = new SourceGrid.Cells.Views.ColumnHeader { ElementText = new DevAge.Drawing.VisualElements.TextRenderer() }; var toolTipController = new ToolTipText(); _grid.ColumnsCount = _entity.Members.Count; _grid.FixedRows = 1; _grid.Rows.Insert(0); _columnMap = ApiUtils.BuildColumnMap(resultSet); for (int i = 0; i < resultSet.FieldCount; i++) { var member = _entity.Members[resultSet.GetFieldName(i)]; _grid[0, _columnMap[i]] = new SourceGrid.Cells.ColumnHeader(HumanText.GetMemberName(member)) { View = headerView, ToolTipText = HumanText.GetMemberName(member), AutomaticSortEnabled = false }; _grid[0, _columnMap[i]].AddController(toolTipController); } }
protected void SetHeader() { gridElement.RowsCount = 0; gridElement.ColumnsCount = 4; gridElement.FixedRows = 1; gridElement.Rows.Insert(0); const int RowIndex = 0; gridElement[RowIndex, 0] = new ColumnHeader("方法"); ((ColumnHeader)gridElement[RowIndex, 0]).AutomaticSortEnabled = false; gridElement[RowIndex, 0].Column.Width = 70; gridElement[RowIndex, 1] = new ColumnHeader("Id"); ((ColumnHeader)gridElement[RowIndex, 1]).AutomaticSortEnabled = false; gridElement[RowIndex, 1].Column.Width = 120; gridElement[RowIndex, 2] = new ColumnHeader("值"); ((ColumnHeader)gridElement[RowIndex, 2]).AutomaticSortEnabled = false; gridElement[RowIndex, 2].Column.Width = 80; gridElement[RowIndex, 3] = new ColumnHeader(""); ((ColumnHeader)gridElement[RowIndex, 3]).AutomaticSortEnabled = false; gridElement[RowIndex, 3].Column.Width = 25; gridElement.VerticalScroll.Visible = true; }
/// <summary> /// constructor /// </summary> /// <param name="ADataGrid"></param> /// <param name="ADataColumn"></param> /// <param name="ACaption"></param> /// <param name="ADataCell"></param> /// <param name="AColumnWidth"></param> /// <param name="ASortableHeader"></param> public TSgrdTextColumn(SourceGrid.DataGrid ADataGrid, System.Data.DataColumn ADataColumn, string ACaption, SourceGrid.Cells.ICellVirtual ADataCell, Int16 AColumnWidth, Boolean ASortableHeader) : base(ADataGrid) { HeaderCell = new SourceGrid.Cells.ColumnHeader(ACaption); if (!ASortableHeader) { ((SourceGrid.Cells.ColumnHeader)HeaderCell).AutomaticSortEnabled = false; } HeaderCell.View = ((TSgrdDataGrid)ADataGrid).ColumnHeaderView; if (ADataColumn != null) { PropertyName = ADataColumn.ColumnName; } DataCell = ADataCell; if (AColumnWidth != -1) { Width = AColumnWidth; AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; } FGrid = ADataGrid; }
public FileGrid() { //SpecialKeys = GridSpecialKeys.None | GridSpecialKeys.Enter | GridSpecialKeys.Escape | GridSpecialKeys.PageDownUp; Rows.Insert(0); //AutoStretchColumnsToFitWidth = true; BackColor = System.Drawing.SystemColors.Window; BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; ColumnsCount = 3; Dock = System.Windows.Forms.DockStyle.Fill; EnableSort = false; FixedRows = 1; //Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSizeView; OptimizeMode = CellOptimizeMode.ForRows; SelectionMode = GridSelectionMode.Row; TabIndex = 2; TabStop = true; //Cannot set those! //this.Location.X = 0; //this.Location.Y = 25; //Margin.All = 4; //Size.Height = 298; //Size.Width = 1038; // Initialise custom editors oneClickEditor = SourceGrid.Cells.Editors.Factory.Create(typeof(string)); oneClickEditor.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.AnyKey | SourceGrid.EditableMode.SingleClick; PreviewKeyDown += delegate(object eventSender, PreviewKeyDownEventArgs karg) { if (karg.KeyCode == Keys.A && karg.Modifiers == Keys.Control) { Selection.SelectRange(new Range(new Position(1, 0), new Position(RowsCount - 1, FileNewNameCol)), true); } }; //Not sure why it does not work here this[0, FileIconCol] = new SourceGrid.Cells.ColumnHeader(); this[0, FileOldNameCol] = new SourceGrid.Cells.ColumnHeader(Textual.FileName); this[0, FileNewNameCol] = new SourceGrid.Cells.ColumnHeader(Textual.NewFileName); //AutoSizeCells(); Columns[FileIconCol].AutoSizeMode = SourceGrid.AutoSizeMode.None; Columns[FileIconCol].Width = 28; Columns[FileOldNameCol].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize | SourceGrid.AutoSizeMode.Default; Columns[FileNewNameCol].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize | SourceGrid.AutoSizeMode.Default; MinimumWidth = 350; AutoSizeCells(); AutoStretchColumnsToFitWidth = true; Columns.StretchToFit(); fileFetcher = new IconFetcher(); }
/// <summary> /// constructor /// </summary> /// <param name="ADataGrid"></param> /// <param name="ACaption"></param> /// <param name="AGetImage"></param> public TSgrdImageColumn(SourceGrid.DataGrid ADataGrid, string ACaption, DelegateGetImageForRow AGetImage) : base(ADataGrid, null, ACaption, null, -1, false) { HeaderCell = new SourceGrid.Cells.ColumnHeader(ACaption); ((SourceGrid.Cells.ColumnHeader)HeaderCell).AutomaticSortEnabled = false; HeaderCell.View = ((TSgrdDataGrid)FGrid).ColumnHeaderView; PropertyName = null; DataCell = null; FGrid = ADataGrid; this.AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; FGetImage = AGetImage; }
private void createGridHeader() { Redim(1, 3); var ttt = new SourceGrid.Cells.ColumnHeader(ApplicationStrings.PluginsGrid_PluginColumn); this[0, 0] = ttt; ttt.Column.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch; this[0, 1] = new SourceGrid.Cells.ColumnHeader(ApplicationStrings.PluginsGrid_IconColumn); this[0, 1].Column.Width = 70; this[0, 2] = new SourceGrid.Cells.ColumnHeader(ApplicationStrings.PluginsGrid_DefaultEntryColumn); this[0, 2].Column.Width = 70; }
private void createGridHeader() { grid1.Redim(1, ColumnsNumber); grid1[0, DeleteColumn] = new SourceGrid.Cells.ColumnHeader(); grid1[0, DeleteColumn].Column.Width = 20; var ttt = new SourceGrid.Cells.ColumnHeader(StrengthTrainingEntryStrings.ExerciseMapperWindow_ColumnFrom); grid1[0, FromExerciseColumn] = ttt; ttt.Column.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch; grid1[0, ToExerciseColumn] = new SourceGrid.Cells.ColumnHeader(StrengthTrainingEntryStrings.ExerciseMapperWindow_ColumnTo); grid1[0, ToExerciseColumn].Column.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch; grid1[0, OperationColumn] = new SourceGrid.Cells.ColumnHeader(StrengthTrainingEntryStrings.ExerciseMapperWindow_ColumnOperation); }
private void frmSample17_Load(object sender, System.EventArgs e) { grid1.Redim(100, 40); grid1.FixedColumns = 0; grid1.FixedRows = 0; 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; for (int i = 0; i < 100; i++) { grid1[i, 0] = new Cell(i); } for (int i = 30; i < 70; i++) { grid1.Rows.ShowRow(i, false); } }
private void createHeader() { Redim(1, StandardColumnNumber); this[0, DeleteButtonColumn] = new SourceGrid.Cells.ColumnHeader(); this[0, DeleteButtonColumn].Column.Width = 20; var ttt = new SourceGrid.Cells.ColumnHeader(SuplementsEntryStrings.SuplementGrid_SuplementColumn); this[0, SuplementTypeColumn] = ttt; ttt.Column.Width = 200; ttt.Column.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch; this[0, SuplementNameColumn] = new SourceGrid.Cells.ColumnHeader(SuplementsEntryStrings.SuplementGrid_NameColumn); this[0, InfoColumn] = new SourceGrid.Cells.ColumnHeader(SuplementsEntryStrings.SuplementGrid_InfoColumn); this[0, DosageTypeColumn] = new SourceGrid.Cells.ColumnHeader(SuplementsEntryStrings.SuplementGrid_DosageTypeColumn); this[0, DosageColumn] = new SourceGrid.Cells.ColumnHeader(SuplementsEntryStrings.SuplementGrid_DosageColumn); this[0, TimeColumn] = new SourceGrid.Cells.ColumnHeader(SuplementsEntryStrings.SuplementGrid_TimeColumn); }
private void SetupLogGrid() { logGrid.ColumnsCount = 4; int i = 0; logGrid.Rows.Insert(0); logGrid[0, i++] = new SourceGrid.Cells.ColumnHeader("Time"); logGrid[0, i++] = new SourceGrid.Cells.ColumnHeader("TickerId"); logGrid[0, i++] = new SourceGrid.Cells.ColumnHeader("Code"); logGrid[0, i++] = new SourceGrid.Cells.ColumnHeader("Message"); logGrid.Columns[3].AutoSizeMode = SourceGrid.AutoSizeMode.EnableStretch; logGrid.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; logGrid.AutoSizeCells(); }
public void LoadList() { if (m_ItemType == null) { throw new ApplicationException("ItemType is null"); } if (m_List == null) { m_List = new ArrayList(); } if (m_Properties.Length != m_Editors.Length) { throw new ApplicationException("Properteis.Length != Editors.Length"); } grid.FixedRows = 1; grid.FixedColumns = 0; grid.Redim(m_List.Count + grid.FixedRows, m_Properties.Length + grid.FixedColumns); //HeaderCell //grid[0,0] = new Cells.Header(); for (int i = 0; i < m_Properties.Length; i++) { Cells.ColumnHeader l_Header = new Cells.ColumnHeader(m_Properties[i].Name.Replace("_", " ")); //GetCustomAttributes(typeof(ListEditor), false)); grid[0, i + grid.FixedColumns] = l_Header; l_Header.AutomaticSortEnabled = false; // //If the column type support the IComparable then I can use the value to sort the column, otherwise I use the string representation for sort. // if (typeof(IComparable).IsAssignableFrom(m_Properties[i].PropertyType)) // l_Header.Comparer = new ValueCellComparer(); // else // l_Header.Comparer = new DisplayStringCellComparer(); } for (int r = 0; r < m_List.Count; r++) { PopulateRow(r + grid.FixedRows, m_List[r]); } grid.AutoStretchColumnsToFitWidth = true; grid.AutoSizeCells(); }
private void BindColumnHeaders(int col) { _grid[0, col] = new SourceGrid.Cells.ColumnHeader(_columnsBindings[col].ColumnName); _grid[0, col].AddController(new CustomSortHeaderCellController(this)); _grid.Columns[col].AutoSizeMode = _columnsBindings[col].ExpandsToFit ? SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch : SourceGrid.AutoSizeMode.EnableAutoSize; // if we are sorting by this column, set the sort icon on the column if (_sortColumnName != null && _sortColumnIndex == col) { ((SourceGrid.Cells.Models.ISortableHeader)_grid[0, col].Model.FindModel(typeof(SourceGrid.Cells.Models.ISortableHeader))).SetSortMode( SourceGrid.CellContext.Empty, _sortDirection == SortDirection.Ascending ? DevAge.Drawing.HeaderSortStyle.Ascending : DevAge.Drawing.HeaderSortStyle.Descending ); } }
private void InitializeAdvanceCorrectionMap() { AdvanceCorrectionDataGridView.Redim(3, 11); AdvanceCorrectionDataGridView.FixedColumns = 1; AdvanceCorrectionDataGridView.FixedRows = 1; AdvanceCorrectionDataGridView.Rows[0].Height = 28; AdvanceCorrectionDataGridView.Rows[1].Height = 28; AdvanceCorrectionDataGridView.Rows[2].Height = 28; SourceGrid.Cells.Views.Cell binCellView = new SourceGrid.Cells.Views.Cell { Font = new Font(Font, FontStyle.Bold), TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter }; AdvanceCorrectionDataGridView[0, 0] = new SourceGrid.Cells.ColumnHeader(string.Empty) { View = emptyHeaderView }; AdvanceCorrectionDataGridView[0, 0].Column.MinimalWidth = 80; AdvanceCorrectionDataGridView[0, 0].Column.MaximalWidth = 200; AdvanceCorrectionDataGridView[0, 0].Column.Width = 80; AdvanceCorrectionDataGridView[1, 0] = new SourceGrid.Cells.ColumnHeader("Bins") { View = rowHeaderView }; AdvanceCorrectionDataGridView[2, 0] = new SourceGrid.Cells.ColumnHeader("Correction") { View = rowHeaderView }; for (int index = 1; index < AdvanceCorrectionDataGridView.ColumnsCount; index++) { SourceGrid.Cells.ColumnHeader header = new SourceGrid.Cells.ColumnHeader(index); AdvanceCorrectionDataGridView[0, index] = header; header.Column.MinimalWidth = 60; header.Column.Width = 60; header.View = columnHeaderView; AdvanceCorrectionDataGridView[1, index] = new Cell(0, advanceEditor) { View = binCellView }; AdvanceCorrectionDataGridView[2, index] = new AdvanceCell(Font, true, (row, col, value) => Controller.IgnitionMap.AdvanceCorrection.UpdateValue(col, value)); } AdvanceCorrectionDataGridView.Width = 0; //This will force a resize so the columns will stretch to fill the space. The width will not actually be set to 0 because the Dock property is set to Fill. }
private int createGridHeader() { int setNumber = GetSeriesNumber(); grid1.Redim(1, StandardColumnNumber + setNumber); grid1[0, DeleteRowColumnIndex] = new SourceGrid.Cells.ColumnHeader(); grid1[0, DeleteRowColumnIndex].Column.Width = 20; var ttt = new SourceGrid.Cells.ColumnHeader(StrengthTrainingEntryStrings.ExerciseColumnHeader); grid1[0, ExerciseColumnIndex] = ttt; ttt.Column.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch; grid1[0, CommentColumnIndex] = new SourceGrid.Cells.ColumnHeader("Info"); for (int i = 0; i < setNumber; i++) { grid1[0, StandardColumnNumber + i] = new SourceGrid.Cells.ColumnHeader(string.Format(StrengthTrainingEntryStrings.SerieColumnHeader, i + 1)); } return(setNumber); }
public void Bug4835() { // Bug report at http://sourcegrid.codeplex.com/WorkItem/View.aspx?WorkItemId=4835 var grid1 = new Grid(); grid1.Redim(1, 10); for (int i = 0; i < 10; i++) { grid1[0, i] = new SourceGrid.Cells.ColumnHeader(i.ToString()); } grid1[0, 7] = null; grid1[0, 6] = null; grid1[0, 5].ColumnSpan = 3; grid1[0, 4] = null; grid1[0, 3] = null; grid1[0, 2].ColumnSpan = 3; }
private void SetupMarketDataGrid(Grid grid) { grid.Parent.Tag = grid; grid.Controller.AddController(new PopupSelection()); grid.ColumnsCount = (int)IBGridColumn.LAST_COLUMN; grid.Rows.Insert(0); for (var i = 0; i < (int)IBGridColumn.LAST_COLUMN; i++) { grid[0, i] = new SourceGrid.Cells.ColumnHeader(((IBGridColumn)i).ToString()); grid[0, i].View = _columnHeaderView; } grid.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; grid.Rows.Insert(1); var cft = typeof(IBSimplefiedContract); foreach (var p in cft.GetProperties()) { var attrs = from a in p.GetCustomAttributes(false) where a is GridCellInfoAttribute select(a as GridCellInfoAttribute).Column; if (!attrs.Any()) { continue; } grid[1, (int)attrs.First()] = new SourceGrid.Cells.Cell(null, p.PropertyType) { Tag = p.PropertyType, View = _yellowView }; } grid.Rows[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; SetupMarketDataGridRow(grid, 1); grid.AutoSizeCells(); SetupMarketDataGridColumns(grid); }
private ICell BuildHeader(string value, int rowSpan, int columnSpan, IView view) { var result = new SourceGrid.Cells.ColumnHeader(value) { View = view, ToolTipText = value, AutomaticSortEnabled = false }; result.AddController(_toolTipController); if (rowSpan > 1) { result.RowSpan = rowSpan; } if (columnSpan > 1) { result.ColumnSpan = columnSpan; } return(result); }
/// <summary> /// constructor /// </summary> /// <param name="ADataGrid"></param> /// <param name="ACaption"></param> /// <param name="AGetImage"></param> public TSgrdImageColumn(SourceGrid.DataGrid ADataGrid, string ACaption, DelegateGetImageForRow AGetImage) : base(ADataGrid, null, ACaption, null, -1, false) { HeaderCell = new SourceGrid.Cells.ColumnHeader(ACaption); ((SourceGrid.Cells.ColumnHeader)HeaderCell).AutomaticSortEnabled = false; HeaderCell.View = ((TSgrdDataGrid)FGrid).ColumnHeaderView; PropertyName = null; DataCell = null; FGrid = ADataGrid; this.AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; FGetImage = AGetImage; }
private void CreateGrid() { IrssLog.Info("Creating configuration grid ..."); try { int row = 0; gridPlugins.Rows.Clear(); gridPlugins.Columns.SetCount(5); // Setup Column Headers gridPlugins.Rows.Insert(row); ColumnHeader header = new ColumnHeader(" "); header.AutomaticSortEnabled = false; gridPlugins[row, ColIcon] = header; gridPlugins[row, ColName] = new ColumnHeader("Name"); gridPlugins[row, ColReceive] = new ColumnHeader("Receive"); gridPlugins[row, ColTransmit] = new ColumnHeader("Transmit"); gridPlugins[row, ColConfigure] = new ColumnHeader("Configure"); gridPlugins.FixedRows = 1; foreach (PluginBase transceiver in _transceivers) { gridPlugins.Rows.Insert(++row); gridPlugins.Rows[row].Tag = transceiver; // Icon Cell if (transceiver.DeviceIcon != null) { Image iconCell = new Image(transceiver.DeviceIcon); iconCell.Editor.EnableEdit = false; gridPlugins[row, ColIcon] = iconCell; } else { gridPlugins[row, ColIcon] = new Cell(); } // Name Cell Cell nameCell = new Cell(transceiver.Name); CustomEvents nameCellController = new CustomEvents(); nameCellController.DoubleClick += PluginDoubleClick; nameCell.AddController(nameCellController); nameCell.AddController(new ToolTipText()); nameCell.ToolTipText = String.Format("{0}\nVersion: {1}\nAuthor: {2}\n{3}", transceiver.Name, transceiver.Version, transceiver.Author, transceiver.Description); gridPlugins[row, ColName] = nameCell; // Receive Cell if (transceiver is IRemoteReceiver || transceiver is IMouseReceiver || transceiver is IKeyboardReceiver) { gridPlugins[row, ColReceive] = new CheckBox(); } else { gridPlugins[row, ColReceive] = new Cell(); } // Transmit Cell if (transceiver is ITransmitIR) { CheckBox checkbox = new CheckBox(); CustomEvents checkboxcontroller = new CustomEvents(); checkboxcontroller.ValueChanged += TransmitChanged; checkbox.Controller.AddController(checkboxcontroller); gridPlugins[row, ColTransmit] = checkbox; } else { gridPlugins[row, ColTransmit] = new Cell(); } // Configure Cell if (transceiver is IConfigure) { Button button = new Button("Configure"); SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += buttonClickEvent_Executed; button.Controller.AddController(buttonClickEvent); gridPlugins[row, ColConfigure] = button; } else { gridPlugins[row, ColConfigure] = new Cell(); } } gridPlugins.Columns[ColIcon].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.Columns[ColName].AutoSizeMode = SourceGrid.AutoSizeMode.Default; gridPlugins.Columns[ColReceive].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.Columns[ColTransmit].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.Columns[ColConfigure].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.AutoStretchColumnsToFitWidth = true; gridPlugins.AutoSizeCells(); gridPlugins.SortRangeRows(new RangeFullGridNoFixedRows(), ColName, true, new ValueCellComparer()); } catch (Exception ex) { IrssLog.Error(ex); MessageBox.Show(this, ex.ToString(), "Error setting up plugin grid", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmSample17_Load(object sender, System.EventArgs e) { grid1.Redim(100, 40); grid1.FixedColumns = 0; grid1.FixedRows = 0; 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; for (int i = 0; i < 100; i++) grid1[i, 0] = new Cell(i); for (int i = 30; i < 70; i++) grid1.Rows.ShowRow(i, false); }
private void SetupMarketDataGrid(Grid grid) { grid.Parent.Tag = grid; grid.Controller.AddController(new PopupSelection()); grid.ColumnsCount = (int) IBGridColumn.LAST_COLUMN; grid.Rows.Insert(0); for (var i = 0; i < (int) IBGridColumn.LAST_COLUMN; i++) { grid[0, i] = new SourceGrid.Cells.ColumnHeader(((IBGridColumn) i).ToString()); grid[0, i].View = _columnHeaderView; } grid.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; grid.Rows.Insert(1); var cft = typeof (IBSimplefiedContract); foreach (var p in cft.GetProperties()) { var attrs = from a in p.GetCustomAttributes(false) where a is GridCellInfoAttribute select (a as GridCellInfoAttribute).Column; if (!attrs.Any()) continue; grid[1, (int) attrs.First()] = new SourceGrid.Cells.Cell(null, p.PropertyType) { Tag = p.PropertyType, View = _yellowView }; } grid.Rows[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; SetupMarketDataGridRow(grid, 1); grid.AutoSizeCells(); SetupMarketDataGridColumns(grid); }
private void SetupLogGrid() { logGrid.ColumnsCount = 4; int i = 0; logGrid.Rows.Insert(0); logGrid[0, i++] = new SourceGrid.Cells.ColumnHeader("Time"); logGrid[0, i++] = new SourceGrid.Cells.ColumnHeader("TickerId"); logGrid[0, i++] = new SourceGrid.Cells.ColumnHeader("Code"); logGrid[0, i++] = new SourceGrid.Cells.ColumnHeader("Message"); logGrid.Columns[3].AutoSizeMode = SourceGrid.AutoSizeMode.EnableStretch; logGrid.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; logGrid.AutoSizeCells(); }
public RuleGrid() { SpecialKeys = GridSpecialKeys.None | GridSpecialKeys.Enter | GridSpecialKeys.Escape | GridSpecialKeys.PageDownUp; SelectionMode = SourceGrid.GridSelectionMode.Row; BackColor = System.Drawing.SystemColors.Window; BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; // padding-right = 4 for ellipse text drag-select ColumnsCount = 5; RowsCount = 1; FixedRows = 1; // Initialise custom editors emptyEditor = new EditorBase(typeof(int)); emptyEditor.EnableEdit = false; readOnlyEditor = new EditorBase(typeof(String)); readOnlyEditor.EnableEdit = false; //ruleTypeEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(string)); //ruleTypeEditor.StandardValues = new string[] { "Delete", "Copy", "Replace" }; //ruleTypeEditor.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.SingleClick; //ruleTypeEditor.Control.DropDownStyle = ComboBoxStyle.DropDownList; emptyGray = new SourceGrid.Cells.Views.Cell(); emptyGray.BackColor = System.Drawing.SystemColors.ControlDark; popMenu = new PopupMenu(this); //Header this[0, ColControl] = new SourceGrid.Cells.ColumnHeader(Textual.Enabled); this[0, ColType] = new SourceGrid.Cells.ColumnHeader(Textual.RuleType); this[0, ColDestination] = new SourceGrid.Cells.ColumnHeader(Textual.DestinationTag + "(?)"); this[0, ColReplacement] = new SourceGrid.Cells.ColumnHeader(Textual.ReplacementText); this[0, ColPattern] = new SourceGrid.Cells.ColumnHeader(Textual.SearchPatterns); this.Columns[ColControl].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; this.Columns[ColType].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; this.Columns[ColDestination].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; this.Columns[ColReplacement].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; this.Columns[ColPattern].AutoSizeMode = SourceGrid.AutoSizeMode.Default | SourceGrid.AutoSizeMode.MinimumSize; this.Columns[ColPattern].MinimalWidth = 800; this.AutoStretchColumnsToFitWidth = true; //Columns.AutoSize(true); //ScrollBar = ScrollBars.Vertical; //this.VScroll = true; //this.SetVScrollBarVisible(true); this[0, ColDestination].ToolTipText = Textual.DestinationTagTooltip; SourceGrid.Cells.Controllers.ToolTipText toolTipController = new SourceGrid.Cells.Controllers.ToolTipText(); toolTipController.IsBalloon = true; this[0, ColDestination].Controller.AddController(toolTipController); foreach(int i in new int[]{ColControl, ColType, ColDestination, ColReplacement, ColPattern}) { this[0, i].RemoveController(this[0, i].FindController(typeof(SourceGrid.Cells.Controllers.SortableHeader))); } AutoSizeCells(); }
private void SetColumnsAndRows(string[] columns, string[] rows, Grid grid) { if (grid.InvokeRequired) { SetNumberOfColumnsAndRows d = SetColumnsAndRows; Invoke(d, columns, rows, grid); } else { grid.Rows.Clear(); grid.Columns.Clear(); grid.Rows.Insert(0); grid.Columns.Insert(0); for (int row = 1; row <= rows.Length; row++) { grid.Rows.Insert(row); grid[row, 0] = new RowHeader(rows[row - 1]); for (int column = 1; column <= columns.Length; column++) { if (row == 1) { grid.Columns.Insert(column); grid[0, column] = new SourceGrid.Cells.ColumnHeader(columns[column - 1]); } grid[row, column] = new Cell(); grid[row, column].View = new SourceGrid.Cells.Views.Cell(); } } grid.AutoSizeCells(); } }
/// <summary> /// constructor /// </summary> /// <param name="ADataGrid"></param> /// <param name="ADataColumn"></param> /// <param name="ACaption"></param> /// <param name="ADataCell"></param> /// <param name="AColumnWidth"></param> /// <param name="ASortableHeader"></param> public TSgrdTextColumn(SourceGrid.DataGrid ADataGrid, System.Data.DataColumn ADataColumn, string ACaption, SourceGrid.Cells.ICellVirtual ADataCell, Int16 AColumnWidth, Boolean ASortableHeader) : base(ADataGrid) { HeaderCell = new SourceGrid.Cells.ColumnHeader(ACaption); if (!ASortableHeader) { ((SourceGrid.Cells.ColumnHeader)HeaderCell).AutomaticSortEnabled = false; } HeaderCell.View = ((TSgrdDataGrid)ADataGrid).ColumnHeaderView; if (ADataColumn != null) { PropertyName = ADataColumn.ColumnName; } DataCell = ADataCell; if (AColumnWidth != -1) { Width = AColumnWidth; AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; } FGrid = ADataGrid; }
private void FillGrid() { SourceGrid.Cells.Views.Cell colTitleModel = new SourceGrid.Cells.Views.Cell { ElementText = new RotatedText(-90.0f), BackColor = Color.SteelBlue, ForeColor = Color.White, TextAlignment = DevAge.Drawing.ContentAlignment.BottomCenter }; SourceGrid.Cells.Views.Cell topleftTitleModel = new SourceGrid.Cells.Views.Cell { BackColor = Color.SteelBlue, ForeColor = Color.White, TextAlignment = DevAge.Drawing.ContentAlignment.BottomLeft }; SourceGrid.Cells.Views.Cell isActorModel = new SourceGrid.Cells.Views.Cell { BackColor = Color.Green, ForeColor = Color.Green, TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft }; SourceGrid.Cells.Views.Cell isGuestModel = new SourceGrid.Cells.Views.Cell { BackColor = Color.LightGreen, ForeColor = Color.LightGreen, TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft }; this.grid1.Columns.Clear(); this.grid1.Rows.Clear(); int rows = this.TheData.DataR + 2; // title and total int cols = this.TheData.DataC + 2; this.grid1.ColumnsCount = cols; this.grid1.RowsCount = rows; this.grid1.FixedColumns = 1; this.grid1.FixedRows = 1; this.grid1.Selection.EnableMultiSelection = false; for (int i = 0; i < cols; i++) { this.grid1.Columns[i].AutoSizeMode = i == 0 ? SourceGrid.AutoSizeMode.Default : SourceGrid.AutoSizeMode.MinimumSize; if (i > 0) this.grid1.Columns[i].Width = 24; } this.grid1.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; this.grid1.Rows[0].Height = 100; ColumnHeader h = new SourceGrid.Cells.ColumnHeader("Show") { AutomaticSortEnabled = false, ResizeEnabled = false }; this.grid1[0, 0] = h; this.grid1[0, 0].View = topleftTitleModel; this.grid1[0, 0].AddController(new SideClickEvent(this, null)); // default sort for (int c = 0; c < this.TheData.DataC; c++) { h = new SourceGrid.Cells.ColumnHeader(this.TheData.Cols[c]) { AutomaticSortEnabled = false, ResizeEnabled = false }; // "<A HREF=\"http://www.imdb.com/find?s=nm&q="+kvp->Key+"\">"+kvp->Key+"</a>"); // h->AddController(sortableController); // h->SortComparer = gcnew SourceGrid::MultiColumnsComparer(c, 0); // TODO: remove? this.grid1[0, c + 1] = h; this.grid1[0, c + 1].View = colTitleModel; this.grid1[0, c + 1].AddController(new TopClickEvent(this, this.TheData.Cols[c])); } int totalCol = this.grid1.ColumnsCount - 1; h = new SourceGrid.Cells.ColumnHeader("Totals") { AutomaticSortEnabled = false, ResizeEnabled = false }; //h->AddController(sortableController); // h->SortComparer = gcnew SourceGrid::MultiColumnsComparer(c, 0); this.grid1.Columns[totalCol].Width = 48; this.grid1[0, totalCol] = h; this.grid1[0, totalCol].View = colTitleModel; this.grid1[0, totalCol].AddController(new SortRowsByCountEvent(this)); for (int r = 0; r < this.TheData.DataR; r++) { this.grid1[r + 1, 0] = new SourceGrid.Cells.RowHeader(this.TheData.Rows[r]) { ResizeEnabled = false }; this.grid1[r + 1, 0].AddController(new SideClickEvent(this, this.TheData.Rows[r])); } this.grid1[this.TheData.DataR + 1, 0] = new SourceGrid.Cells.RowHeader("Totals") { ResizeEnabled = false }; this.grid1[this.TheData.DataR + 1, 0].AddController(new SortColsByCountEvent(this)); for (int c = 0; c < this.TheData.DataC; c++) { for (int r = 0; r < this.TheData.DataR; r++) { if (this.TheData.Data[r][c].HasValue) { this.grid1[r + 1, c + 1] = new SourceGrid.Cells.Cell("Y") { View = this.TheData.Data[r][c].Value ? isActorModel : isGuestModel }; this.grid1[r + 1, c + 1].AddController(new CellClickEvent(this.TheData.Cols[c], this.TheData.Rows[r])); } else this.grid1[r + 1, c + 1] = new SourceGrid.Cells.Cell(""); } } for (int c = 0; c < this.TheData.DataC; c++) this.grid1[rows - 1, c + 1] = new SourceGrid.Cells.Cell(this.TheData.ColScore(c)); for (int r = 0; r < this.TheData.DataR; r++) this.grid1[r + 1, cols - 1] = new SourceGrid.Cells.Cell(this.TheData.RowScore(r, null)); this.grid1[this.TheData.DataR + 1, this.TheData.DataC + 1] = new SourceGrid.Cells.Cell(""); this.grid1.AutoSizeCells(); }
public void LoadList() { if (m_ItemType == null) throw new ApplicationException("ItemType is null"); if (m_List == null) m_List = new ArrayList(); if (m_Properties.Length != m_Editors.Length) throw new ApplicationException("Properteis.Length != Editors.Length"); grid.FixedRows = 1; grid.FixedColumns = 0; grid.Redim(m_List.Count+grid.FixedRows, m_Properties.Length+grid.FixedColumns); //HeaderCell //grid[0,0] = new Cells.Header(); for (int i = 0; i < m_Properties.Length; i++) { Cells.ColumnHeader l_Header = new Cells.ColumnHeader(m_Properties[i].Name); grid[0, i+grid.FixedColumns] = l_Header; l_Header.AutomaticSortEnabled = false; // //If the column type support the IComparable then I can use the value to sort the column, otherwise I use the string representation for sort. // if (typeof(IComparable).IsAssignableFrom(m_Properties[i].PropertyType)) // l_Header.Comparer = new ValueCellComparer(); // else // l_Header.Comparer = new DisplayStringCellComparer(); } for (int r = 0; r < m_List.Count; r++) { PopulateRow(r+grid.FixedRows, m_List[r]); } grid.AutoStretchColumnsToFitWidth = true; grid.AutoSizeCells(); }
public void Bug4835() { // Bug report at http://sourcegrid.codeplex.com/WorkItem/View.aspx?WorkItemId=4835 var grid1 = new Grid(); grid1.Redim(1,10); for (int i = 0; i < 10; i++) grid1[0, i] = new SourceGrid.Cells.ColumnHeader(i.ToString()); grid1[0, 7] = null; grid1[0, 6] = null; grid1[0, 5].ColumnSpan = 3; grid1[0, 4] = null; grid1[0, 3] = null; grid1[0, 2].ColumnSpan = 3; }
private void FillGrid() { SourceGrid.Cells.Views.Cell colTitleModel = new SourceGrid.Cells.Views.Cell { ElementText = new RotatedText(-90.0f), BackColor = Color.SteelBlue, ForeColor = Color.White, TextAlignment = DevAge.Drawing.ContentAlignment.BottomCenter }; SourceGrid.Cells.Views.Cell topleftTitleModel = new SourceGrid.Cells.Views.Cell { BackColor = Color.SteelBlue, ForeColor = Color.White, TextAlignment = DevAge.Drawing.ContentAlignment.BottomLeft }; SourceGrid.Cells.Views.Cell isActorModel = new SourceGrid.Cells.Views.Cell { BackColor = Color.Green, ForeColor = Color.Green, TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft }; SourceGrid.Cells.Views.Cell isGuestModel = new SourceGrid.Cells.Views.Cell { BackColor = Color.LightGreen, ForeColor = Color.LightGreen, TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft }; this.grid1.Columns.Clear(); this.grid1.Rows.Clear(); int rows = this.TheData.DataR + 2; // title and total int cols = this.TheData.DataC + 2; this.grid1.ColumnsCount = cols; this.grid1.RowsCount = rows; this.grid1.FixedColumns = 1; this.grid1.FixedRows = 1; this.grid1.Selection.EnableMultiSelection = false; for (int i = 0; i < cols; i++) { this.grid1.Columns[i].AutoSizeMode = i == 0 ? SourceGrid.AutoSizeMode.Default : SourceGrid.AutoSizeMode.MinimumSize; if (i > 0) { this.grid1.Columns[i].Width = 24; } } this.grid1.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; this.grid1.Rows[0].Height = 100; ColumnHeader h = new SourceGrid.Cells.ColumnHeader("Show") { AutomaticSortEnabled = false, ResizeEnabled = false }; this.grid1[0, 0] = h; this.grid1[0, 0].View = topleftTitleModel; this.grid1[0, 0].AddController(new SideClickEvent(this, null)); // default sort for (int c = 0; c < this.TheData.DataC; c++) { h = new SourceGrid.Cells.ColumnHeader(this.TheData.Cols[c]) { AutomaticSortEnabled = false, ResizeEnabled = false }; // "<A HREF=\"http://www.imdb.com/find?s=nm&q="+kvp->Key+"\">"+kvp->Key+"</a>"); // h->AddController(sortableController); // h->SortComparer = gcnew SourceGrid::MultiColumnsComparer(c, 0); // TODO: remove? this.grid1[0, c + 1] = h; this.grid1[0, c + 1].View = colTitleModel; this.grid1[0, c + 1].AddController(new TopClickEvent(this, this.TheData.Cols[c])); } int totalCol = this.grid1.ColumnsCount - 1; h = new SourceGrid.Cells.ColumnHeader("Totals") { AutomaticSortEnabled = false, ResizeEnabled = false }; //h->AddController(sortableController); // h->SortComparer = gcnew SourceGrid::MultiColumnsComparer(c, 0); this.grid1.Columns[totalCol].Width = 48; this.grid1[0, totalCol] = h; this.grid1[0, totalCol].View = colTitleModel; this.grid1[0, totalCol].AddController(new SortRowsByCountEvent(this)); for (int r = 0; r < this.TheData.DataR; r++) { this.grid1[r + 1, 0] = new SourceGrid.Cells.RowHeader(this.TheData.Rows[r]) { ResizeEnabled = false }; this.grid1[r + 1, 0].AddController(new SideClickEvent(this, this.TheData.Rows[r])); } this.grid1[this.TheData.DataR + 1, 0] = new SourceGrid.Cells.RowHeader("Totals") { ResizeEnabled = false }; this.grid1[this.TheData.DataR + 1, 0].AddController(new SortColsByCountEvent(this)); for (int c = 0; c < this.TheData.DataC; c++) { for (int r = 0; r < this.TheData.DataR; r++) { if (this.TheData.Data[r][c].HasValue) { this.grid1[r + 1, c + 1] = new SourceGrid.Cells.Cell("Y") { View = this.TheData.Data[r][c].Value ? isActorModel : isGuestModel }; this.grid1[r + 1, c + 1].AddController(new CellClickEvent(this.TheData.Cols[c], this.TheData.Rows[r])); } else { this.grid1[r + 1, c + 1] = new SourceGrid.Cells.Cell(""); } } } for (int c = 0; c < this.TheData.DataC; c++) { this.grid1[rows - 1, c + 1] = new SourceGrid.Cells.Cell(this.TheData.ColScore(c)); } for (int r = 0; r < this.TheData.DataR; r++) { this.grid1[r + 1, cols - 1] = new SourceGrid.Cells.Cell(this.TheData.RowScore(r, null)); } this.grid1[this.TheData.DataR + 1, this.TheData.DataC + 1] = new SourceGrid.Cells.Cell(""); this.grid1.AutoSizeCells(); }
private void CreateGrid() { IrssLog.Info("Creating configuration grid ..."); try { int row = 0; gridPlugins.Rows.Clear(); gridPlugins.Columns.SetCount(5); // Setup Column Headers gridPlugins.Rows.Insert(row); ColumnHeader header = new ColumnHeader(" "); header.AutomaticSortEnabled = false; gridPlugins[row, ColIcon] = header; gridPlugins[row, ColName] = new ColumnHeader("Name"); gridPlugins[row, ColReceive] = new ColumnHeader("Receive"); gridPlugins[row, ColTransmit] = new ColumnHeader("Transmit"); gridPlugins[row, ColConfigure] = new ColumnHeader("Configure"); gridPlugins.FixedRows = 1; foreach (PluginBase transceiver in _transceivers) { gridPlugins.Rows.Insert(++row); gridPlugins.Rows[row].Tag = transceiver; // Icon Cell if (transceiver.DeviceIcon != null) { Image iconCell = new Image(transceiver.DeviceIcon); iconCell.Editor.EnableEdit = false; gridPlugins[row, ColIcon] = iconCell; } else { gridPlugins[row, ColIcon] = new Cell(); } // Name Cell Cell nameCell = new Cell(transceiver.Name); CustomEvents nameCellController = new CustomEvents(); nameCellController.DoubleClick += PluginDoubleClick; nameCell.AddController(nameCellController); nameCell.AddController(new ToolTipText()); nameCell.ToolTipText = String.Format("{0}\nVersion: {1}\nAuthor: {2}\n{3}", transceiver.Name, transceiver.Version, transceiver.Author, transceiver.Description); gridPlugins[row, ColName] = nameCell; // Receive Cell if (transceiver is IRemoteReceiver || transceiver is IMouseReceiver || transceiver is IKeyboardReceiver) { gridPlugins[row, ColReceive] = new CheckBox(); } else { gridPlugins[row, ColReceive] = new Cell(); } // Transmit Cell if (transceiver is ITransmitIR) { CheckBox checkbox = new CheckBox(); CustomEvents checkboxcontroller = new CustomEvents(); checkboxcontroller.ValueChanged += TransmitChanged; checkbox.Controller.AddController(checkboxcontroller); gridPlugins[row, ColTransmit] = checkbox; } else { gridPlugins[row, ColTransmit] = new Cell(); } // Configure Cell if (transceiver is IConfigure) { Button button = new Button("Configure"); SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += buttonClickEvent_Executed; button.Controller.AddController(buttonClickEvent); gridPlugins[row, ColConfigure] = button; } else { gridPlugins[row, ColConfigure] = new Cell(); } } gridPlugins.Columns[ColIcon].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.Columns[ColName].AutoSizeMode = SourceGrid.AutoSizeMode.Default; gridPlugins.Columns[ColReceive].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.Columns[ColTransmit].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.Columns[ColConfigure].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.AutoStretchColumnsToFitWidth = true; gridPlugins.AutoSizeCells(); gridPlugins.SortRangeRows(new RangeFullGridNoFixedRows(), ColName, true, new ValueCellComparer()); } catch (Exception ex) { IrssLog.Error(ex); MessageBox.Show(this, ex.ToString(), "Error setting up plugin grid", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public virtual void Init() { SourceGrid.Cells.Views.Cell v_Normal = new SSIT.PropertyBase.Resources().V_Common; SourceGrid.Cells.Views.Cell v_ReadOnly = new SSIT.PropertyBase.Resources().V_Common; v_ReadOnly.BackColor = System.Drawing.SystemColors.Control; Redim(Fields.Count + FixedRows, HeaderCount + SampleCount + 2); this[0, 0] = new Cells.Header("序号"); this[0, 1] = new Cells.Header("检验项目"); this[0, 2] = new Cells.Header("项目类型"); this[0, 3] = new Cells.Header("值类型"); this[0, 4] = new Cells.Header("检验标准"); this[0, 5] = new Cells.Header("合格率要求(%)"); for (int i = 0; i < Fields.Count; i++) { int rowindex = i + FixedRows; this[rowindex, 1] = new Cells.Header(Fields[i].FieldName); this[rowindex, 2] = new Cells.Header(Fields[i].CheckType); this[rowindex, 3] = new Cells.Header(ValueTypeClass.GetStringValue(Fields[i].ValueType)); this[rowindex, 4] = new Cells.Header(Fields[i].StandardStr); this[rowindex, 5] = new Cells.Header(Fields[i].QualifyRate); this[rowindex, 0] = new Cells.RowHeader(i + 1); this[rowindex, 0].Tag = Fields[i]; } for (int i = 0; i < SampleCount; i++) { this[0, i + HeaderCount] = new Cells.ColumnHeader(string.Format("第 {0} 个样本", i + 1)); } SSIT.PropertyBase.Resources res = new SSIT.PropertyBase.Resources(); for (int j = 0; j < Fields.Count; j++) { if (Fields[j].ValueType == ValueTypeEnum.Selection) { if (!string.IsNullOrWhiteSpace(Fields[j].StandardStr)) { string[] strs = Fields[j].StandardStr.Split(new char[] { '|', '|' });// SSITEncode.Common.STRING.Split(Fields[j].StandardStr, "||"); List <string> list = new List <string>(); if (strs != null) { foreach (string str in strs) { if (!string.IsNullOrWhiteSpace(str)) { list.Add(str); } } } eSelection = res.EncodeComboBox(list, false); } else { eSelection = res.EncodeComboBox(new string[] { string.Empty }, false); } } for (int i = HeaderCount; i < SampleCount + HeaderCount; i++) { Cells.Cell cell = new SourceGrid.Cells.Cell(); if (!Fields[j].ReadOnly) { switch (Fields[j].ValueType) { case ValueTypeEnum.Logic: cell.Editor = eLogic; break; case ValueTypeEnum.Number: cell.Editor = eNum; break; case ValueTypeEnum.Selection: cell.Editor = eSelection; break; } //cell.View = v_Normal; } else { cell.Editor = eNumReadOnly; // cell.View = v_ReadOnly; } cell.View = new SSIT.PropertyBase.Resources().V_Standard; this[j + FixedRows, i] = cell; } } //合格率 合格判定 this[0, HeaderCount + SampleCount] = new Cells.Header("合格率(%)"); this[0, HeaderCount + SampleCount + 1] = new Cells.Header("合格判定"); for (int i = 0; i < Fields.Count; i++) { int rowindex = i + FixedRows; this[rowindex, HeaderCount + SampleCount] = new Cells.Header(); this[rowindex, HeaderCount + SampleCount + 1] = new Cells.Header(); } this.Columns.AutoSize(true); this.Selection.SelectionMode = SourceGrid.GridSelectionMode.Cell; }