/// <summary> /// Returns a non contiguous range of cells of the intersection between the current range and the specified range. /// </summary> /// <param name="p_Range"></param> /// <returns></returns> public virtual RangeRegion Intersect(Range p_Range) { RangeRegion range = new RangeRegion(); if (p_Range.IsEmpty() == false && IsEmpty() == false) { //Range for (int i = 0; i < m_RangeCollection.Count; i++) { Range intersectRange = p_Range.Intersect(m_RangeCollection[i]); if (intersectRange.IsEmpty() == false) { range.m_RangeCollection.Add(intersectRange); } } } return(range); }
public Range FindDestinationRange(GridVirtual destinationGrid, Position dropDestination) { if (dropDestination.IsEmpty()) { return(Range.Empty); } Position destinationStart = new Position(dropDestination.Row + (mSourceRange.Start.Row - mStartDragPosition.Row), dropDestination.Column + (mSourceRange.Start.Column - mStartDragPosition.Column)); destinationStart = Position.Max(destinationStart, new Position(0, 0)); Range destination = mSourceRange; destination.MoveTo(destinationStart); destination = destination.Intersect(destinationGrid.CompleteRange); return(destination); }
/// <summary> /// Returns a non contiguous range of cells of the intersection between the current range and the specified range. /// </summary> /// <param name="p_Range"></param> /// <returns></returns> public virtual RangeRegion Intersect(Range p_Range) { RangeRegion range = new RangeRegion(); if (p_Range.IsEmpty() == false && IsEmpty() == false) { //Range for (int i = 0; i < m_RangeCollection.Count; i++) { Range intersectRange = p_Range.Intersect(m_RangeCollection[i]); if (intersectRange.IsEmpty() == false) range.m_RangeCollection.Add(intersectRange); } } return range; }