Beispiel #1
0
        public override void OnRemovingRange(RangeRegionCancelEventArgs e)
        {
            base.OnRemovingRange(e);

            RangeRegionChangingEventArgs regionChanging = new RangeRegionChangingEventArgs(e.RangeRegion, new SourceGrid.RangeRegion(), new SourceGrid.RangeRegion());
            PositionCollection           exploredPos    = new PositionCollection();

            do
            {
                regionChanging.RegionToExclude.Clear();
                regionChanging.RegionToInclude.Clear();

                PositionCollection positions = e.RangeRegion.GetCellsPositions();
                for (int i = 0; i < positions.Count; i++)
                {
                    if (exploredPos.Contains(positions[i]) == false)
                    {
                        CellContext cellContext = new CellContext(Grid, positions[i]);
                        Grid.Controller.OnSelectionRemoving(cellContext, regionChanging);
                        exploredPos.Add(positions[i]);
                    }
                }

                regionChanging.CurrentRegion.Add(regionChanging.RegionToInclude);
                regionChanging.CurrentRegion.Remove(regionChanging.RegionToExclude);
            } while (!regionChanging.RegionToExclude.IsEmpty() || !regionChanging.RegionToInclude.IsEmpty());
        }
Beispiel #2
0
        /// <summary>
        /// Returns the union of all the selected range as Position collection
        /// </summary>
        /// <returns></returns>
        public PositionCollection GetCellsPositions()
        {
            if (m_PositionListCache == null)
            {
                m_PositionListCache = new PositionCollection();
                for (int i = 0; i < m_RangeList.Count; i++)
                {
                    PositionCollection l_tmp = m_RangeList[i].GetCellsPositions();
                    for (int j = 0; j < l_tmp.Count; j++)
                    {
                        if (m_PositionListCache.Contains(l_tmp[j]) == false)
                        {
                            m_PositionListCache.Add(l_tmp[j]);
                        }
                    }
                }
            }

            return(m_PositionListCache);
        }