如何在 AdvStringGrid (TMS) 中进行反向选择?
问问题
1275 次
1 回答
4
假设 NGLN 是正确的,您需要在 Grid.MouseActions 中设置正确的 Disjunct...Select 选项以选择您允许的选择类型,然后您可以调用此过程:
PROCEDURE InvertSelection(Grid : TAdvStringGrid);
VAR
C,R : Cardinal;
BEGIN
IF Grid.MouseActions.DisjunctCellSelect THEN
FOR R:=Grid.FixedRows TO PRED(Grid.RowCount) DO FOR C:=Grid.FixedCols TO PRED(Grid.ColCount) DO Grid.SelectedCells[C,R]:=NOT Grid.SelectedCells[C,R]
ELSE IF Grid.MouseActions.DisjunctRowSelect THEN
FOR R:=Grid.FixedRows TO PRED(Grid.RowCount) DO Grid.RowSelect[R]:=NOT Grid.RowSelect[R]
ELSE IF Grid.MouseActions.DisjunctColSelect THEN
FOR C:=Grid.FixedCols TO PRED(Grid.ColCount) DO Grid.ColSelect[C]:=NOT Grid.ColSelect[C]
END;
这将使所有未选择的行/列/单元格被选中,反之亦然。
于 2011-10-09T07:32:02.053 回答