SourceGrid.Range.Contains C# (CSharp) Method

Contains() public method

Returns true if the specified cell position is present in the current range.
public Contains ( Position p_Position ) : bool
p_Position Position
return bool
        public bool Contains(Position p_Position)
        {
            int l_Row = p_Position.Row;
            int l_Col = p_Position.Column;

            return (l_Row >= m_Start.Row &&
                    l_Col >= m_Start.Column &&
                    l_Row <= m_End.Row &&
                    l_Col <= m_End.Column);
        }

Same methods

Range::Contains ( Range p_Range ) : bool

Usage Example

Beispiel #1
0
        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;
                    }
                }
            }
        }
All Usage Examples Of SourceGrid.Range::Contains