type THackedGrid = class (TStringGrid);
<CODE>procedure TForm1.SortStringGrid(AGrid: TStringGrid; SortCol: integer); var i, J: integer; begin with AGrid do //contrôler que la colonne à trier est dans les limites if (SortCol > FixedCols) and (SortCol < = ColCount) then for i := FixedRows to RowCount - 2do for j : = i + 1to RowCount - 1do //comparaison non sensible à la casse if AnsiCompareText(Cells[SortCol, i], Cells[SortCol, j]) > 0then //permuter les deux lignes THackedGrid(Agrid).RowMoved(j, i); end;
procedure TForm1.btnSortStringGridClick(Sender: TObject); begin SortStringGrid(StringGrid1, StrToIntDef(Edit1.Text, 1)); end;
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question