SourceGrid.RangeRegion.Contains C# (CSharp) Method

Contains() public method

Indicates if the specified cell is selected
public Contains ( Position p_Cell ) : bool
p_Cell Position
return bool
        public virtual bool Contains(Position p_Cell)
        {
            if (p_Cell.IsEmpty() || IsEmpty())
                return false;

            //Range
            for (int i = 0; i < m_RangeCollection.Count; i++)
            {
                if (m_RangeCollection[i].Contains(p_Cell))
                    return true;
            }

            return false;
        }

Same methods

RangeRegion::Contains ( Range p_Range ) : bool
RangeRegion::Contains ( RangeRegion p_Range ) : bool

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Prende un range che è già stato filtrato con solo le celle non presenti nell'attuale range
        /// </summary>
        /// <param name="pRange"></param>
        /// <returns></returns>
        private bool InternalAdd(RangeRegion pRange)
        {
            if (Contains(pRange))
            {
                return(true);
            }

            if (pRange.Contains(this))             //change all the contents with the new range
            {
                RangeRegion existingRange = new RangeRegion(this);

                m_RangeCollection.Clear();
                m_RangeCollection.AddRange(pRange.m_RangeCollection);

                pRange = pRange.Exclude(existingRange);
            }
            else
            {
                pRange = pRange.Exclude(this);
                if (pRange.IsEmpty())
                {
                    return(true);                    //il range è vuoto
                }
                pRange.m_bValidated = true;

                RangeRegionCancelEventArgs e = new RangeRegionCancelEventArgs(pRange);
                OnAddingRange(e);                 //calling this method the range can change
                if (e.Cancel)
                {
                    return(false);
                }

                if (pRange.m_bValidated == false)
                {
                    pRange = pRange.Exclude(this);
                    if (pRange.IsEmpty())
                    {
                        return(true);                        //il range è vuoto
                    }
                }

                for (int rToAdd = 0; rToAdd < pRange.m_RangeCollection.Count; rToAdd++)
                {
                    Range rangeToAdd = pRange.m_RangeCollection[rToAdd];
                    m_RangeCollection.Add(rangeToAdd);
                }
            }

            OnAddedRange(new RangeRegionCancelEventArgs(pRange));

            m_bValidated = false;

            return(true);
        }
All Usage Examples Of SourceGrid.RangeRegion::Contains