public virtual System.Int32 Compare(System.Object x, System.Object y) { int ret = m_defaultComparer.Compare(x, y); if (ret == 0) { SourceGrid.Grid grid = ((SourceGrid.Cells.ICell)x).Grid; int rowX = ((SourceGrid.Cells.ICell)x).Range.Start.Row; int rowY = ((SourceGrid.Cells.ICell)y).Range.Start.Row; int indexOrder = 0; while (indexOrder < m_SecondarySortColumns.Length) { SourceGrid.Cells.ICellVirtual otherX = grid.GetCell(rowX, m_SecondarySortColumns[indexOrder]); SourceGrid.Cells.ICellVirtual otherY = grid.GetCell(rowY, m_SecondarySortColumns[indexOrder]); int subRet = m_defaultComparer.Compare(otherX, otherY); if (subRet != 0) { return(subRet); } indexOrder++; } return(0); } else { return(ret); } }
public SourceGrid.Cells.ICellVirtual ApplyCondition(SourceGrid.Cells.ICellVirtual cell) { SourceGrid.Cells.ICellVirtual copied = cell.Copy(); copied.View = View; return(copied); }
public SourceGrid.DataGridColumn Add(string property, string caption, Type propertyType) { SourceGrid.Cells.ICellVirtual cell = SourceGrid.Cells.DataGrid.Cell.Create(propertyType, true); return(Add(property, caption, cell)); }
protected virtual void Bind() { ValueCell = null; if (mDataSource != null) { mValueCell = new SourceGrid.Cells.Virtual.CellVirtual(); mValueCell.Model.AddModel(new ImageValueModel()); } Rows.RowsChanged(); Columns.ColumnsChanged(); }
public SourceGrid.DataGridColumn Add(string property, string caption, SourceGrid.Cells.ICellVirtual cell) { SourceGrid.DataGridColumn col = new DataGridColumn(Grid, new SourceGrid.Cells.DataGrid.ColumnHeader(caption), cell, property); Insert(Count, col); return(col); }
/// <summary> /// ќтобразить данные /// </summary> protected virtual void Bind() { ValueCell = null; if (_dataSource != null) { Init(); _valueCell = new SourceGrid.Cells.Virtual.CellVirtual(); _valueCell.Model.AddModel(new FRomValueModel()); _valueCell.Editor = SourceGrid.Cells.Editors.Factory.Create(typeof(uint)); } Rows.RowsChanged(); Columns.ColumnsChanged(); RecalcColor(); //ѕересчет переменных дл¤ задани¤ цвета }
/// <summary> /// Helper function to discover if any control in a specified container wants to handle the Escape key. /// For example, a combo box that is dropped down would want to handle escape so as to close the list. /// </summary> /// <param name="AContainerControl">The container control to recursively search</param> /// <returns>True if any control in the container wants to handle escape</returns> public bool AContainerControlWantsEscape(object AContainerControl) { // Assume that no controls want to handle ESCape bool WantsEscape = false; foreach (Control control in ((Control)AContainerControl).Controls) { // The various ComboBox derivatives want ESCape if the list is Dropped Down if (control is ComboBox) { WantsEscape = ((ComboBox)control).DroppedDown; } else if (control is TUC_CountryComboBox) { WantsEscape = ((TUC_CountryComboBox)control).DroppedDown; } else if (control is TUC_CountryLabelledComboBox) { WantsEscape = ((TUC_CountryLabelledComboBox)control).DroppedDown; } else if (control is TCmbAutoPopulated) { WantsEscape = ((TCmbAutoPopulated)control).cmbCombobox.DroppedDown; } else if (control is TSgrdDataGrid) { // The grid wants ESCape if a cell is being edited TSgrdDataGrid grid = (TSgrdDataGrid)control; SourceGrid.CellContext focusCellContext = new SourceGrid.CellContext(grid, grid.Selection.ActivePosition); SourceGrid.Cells.ICellVirtual contextCell = focusCellContext.Cell; WantsEscape = ((contextCell != null) && (contextCell.Editor != null) && (contextCell.Editor.IsEditing)); } else if (control.Controls.Count > 0) { // Recursive call to ourself for the controls in this container WantsEscape = AContainerControlWantsEscape(control); } if (WantsEscape) { break; } } return(WantsEscape); }
public DataGridColumnAlternate(SourceGrid.DataGrid grid, DataColumn dataColumn, string caption, SourceGrid.Cells.ICellVirtual dataCell, Color alternateBackColor) : base(grid) { DataColumn = dataColumn; HeaderCell = new SourceGrid.DataGridColumnHeader(caption); HeaderCell.View = viewColHeader; DataCell = dataCell; AlternateDataCell = dataCell.Copy(); AlternateDataCell.View = (SourceGrid.Cells.Views.IView)DataCell.View.Clone(); AlternateDataCell.View.BackColor = alternateBackColor; }
public MyDataGridColumn(SourceGrid.DataGrid grid, System.Data.DataColumn dataColumn, string caption, SourceGrid.Cells.ICellVirtual dataCell) : base(grid) { HeaderCell = new SourceGrid.DataGridColumnHeader(caption); DataColumn = dataColumn; DataCell = null; if (dataCell != null) { //Add a ToolTip dataCell.AddController(SourceGrid.Cells.Controllers.ToolTipText.Default); dataCell.Model.AddModel(MyToolTipModel.Default); dataCellSelected_OFF = dataCell; dataCellSelected = dataCell.Copy(); dataCellSelected.View = (SourceGrid.Cells.Views.IView)dataCell.View.Clone(); dataCellSelected.View.ForeColor = Color.DarkGreen; dataCellSelected.View.Font = new Font(grid.Font, FontStyle.Bold); } }
public static DataGridColumn Create(DataGrid grid, System.Data.DataColumn dataColumn, string caption, SourceGrid.Cells.ICellVirtual cell) { return(new DataGridColumn(grid, dataColumn, new DataGridColumnHeader(caption), cell)); }
public ConditionCell(SourceGrid.Cells.ICellVirtual cell) { mCell = cell; }
public SourceGrid.Cells.ICellVirtual ApplyCondition(SourceGrid.Cells.ICellVirtual cell) { return(Cell); }
private void RecalcBorderRange() { if (IsEmpty()) { mRangeHighlight.Range = Range.Empty; } else { if (BorderMode == SelectionBorderMode.FocusCell) { if (m_ActivePosition.IsEmpty() == false) { mRangeHighlight.Range = Grid.PositionToCellRange(m_ActivePosition); } else { mRangeHighlight.Range = Range.Empty; } } else if (BorderMode == SelectionBorderMode.FocusRange) { RangeCollection selectedRanges = GetRanges(); for (int i = 0; i < selectedRanges.Count; i++) { Range range = selectedRanges[i]; if (range.Contains(m_ActivePosition)) { mRangeHighlight.Range = range; return; } } mRangeHighlight.Range = Range.Empty; } else if (BorderMode == SelectionBorderMode.UniqueRange) { RangeCollection selectedRanges = GetRanges(); if (selectedRanges.Count == 1) { mRangeHighlight.Range = selectedRanges[0]; } else { mRangeHighlight.Range = Range.Empty; } } else if (BorderMode == SelectionBorderMode.Auto) { RangeCollection selectedRanges = GetRanges(); if (selectedRanges.Count == 1) { mRangeHighlight.Range = selectedRanges[0]; } else if (m_ActivePosition.IsEmpty() == false) { mRangeHighlight.Range = Grid.PositionToCellRange(m_ActivePosition); } else { mRangeHighlight.Range = Range.Empty; } } else { mRangeHighlight.Range = Range.Empty; } //Set if the selected cells have the OwnerDrawSelectionBorder enabled. if (mRangeHighlight.Range.ColumnsCount == 1 && mRangeHighlight.Range.RowsCount == 1) { SourceGrid.Cells.ICellVirtual cell = Grid.GetCell(mRangeHighlight.Range.Start); if (cell != null && cell.View.OwnerDrawSelectionBorder) { mRangeHighlight.Range = Range.Empty; } } } }