📄 unit1.pas
字号:
unit Unit1;
//
// Sujet : Tri d'un TStringGrid
//
// Par Nono40 : http://nono40.developpez.com http://nono40.fr.st
// mailTo:nono40@fr.st
//
// Le 15/03/2003
//
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ D閏larations priv閑s }
public
{ D閏larations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Procedure TForm1.Button1Click(Sender: TObject);
Var i,j:Integer;
S:String;
Begin
With StringGrid1 Do
Begin
For i:=1 To rowcount-2 Do
For j:=i+1 To RowCount-1 Do
If Cells[1,i]>Cells[1,j] Then
Begin
S := Rows[i].Text;
Rows[i].Text := Rows[j].Text;
Rows[j].Text := S;
End;
End;
End;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -