示例#1
0
        private void ProcessControlExtend(GridPanel panel, bool extend)
        {
            if (panel.LastProcessedItem == null)
                panel.LastProcessedItem = _MouseDownHitRow;

            GridContainer lastRow = panel.LastProcessedItem as GridContainer;

            if (lastRow != null)
            {
                int startIndex = lastRow.GridIndex;
                int endIndex = _HitItem.GridIndex;

                panel.NormalizeIndices(extend,
                    _AnchorIndex, ref startIndex, ref endIndex);

                for (int i = startIndex; i <= endIndex; i++)
                {
                    if (extend == false || i != _AnchorIndex)
                        panel.SetSelectedRows(i, 1, !panel.IsRowSelected(i));
                }

                InvalidateRows(panel, startIndex, endIndex, true);
            }
        }
示例#2
0
        internal void ExtendSelection(
            GridPanel panel, GridContainer endItem, bool extend)
        {
            int startIndex = panel.SelectionRowAnchor.GridIndex;
            int endIndex = endItem.GridIndex;

            panel.NormalizeIndices(false, 0, ref startIndex, ref endIndex);

            if (panel.OnlyRowsSelected(startIndex, endIndex) == false)
            {
                if (extend == false)
                    panel.ClearAllSelected();
                else
                    panel.ClearAll(false);

                panel.SetSelectedRows(startIndex, endIndex - startIndex + 1, true);

                GridContainer row = GetLastProcessedRow(panel);

                if (extend == true && row != null)
                    startIndex = row.GridIndex;

                InvalidateRows(panel, startIndex, endIndex, extend);
            }
        }