procedure TFrmMain.GridSort(Grid: TStringGrid; SortCol: Integer);
{===============================================================================
グリッドをソートする。
===============================================================================}
var
str_St1: TStringList;
str_St2: TStringList;
int_i: Integer;
begin
str_St1 := TStringList.Create;
str_St1.Assign(Grid.Cols[SortCol]);
for int_i := 1 To Grid.FixedRows Do str_St1.Delete(0);
for int_i := 0 to str_St1.Count - 1 do
str_St1.Strings[int_i] := str_St1.Strings[int_i] + #1 + Format('%.10d',[int_i]);
for int_i := Grid.FixedRows to Grid.RowCount - 1 do begin
str_St2 := TStringList.Create;
str_St2.Assign(Grid.Rows[int_i]);
str_St1.Objects[int_i - Grid.FixedRows] := str_St2;
end;
str_St1.Sort;
for int_i := Grid.FixedRows to Grid.RowCount - 1 do begin
Grid.Rows[int_i].Assign(TStringList(str_St1.Objects[int_i -
Grid.FixedRows]));
TStringList(str_St1.Objects[int_i - Grid.FixedRows]).Free;
end;
str_St1.Free;
end;