stringgrid删除选中行

作者: 傻猫    分类: 搞软件     发布时间: 07-04 10:32    浏览次数: 3951     无留言

StringGrid排序/隔行变色

作者: 傻猫    分类: 搞软件     发布时间: 07-04 09:46    浏览次数: 3905     无留言

//排序函数//////////////////////////////////////////////
procedure Quicksort(Grid:TStringGrid; var List:array of integer;

min, max,sortcol,datatype: Integer);

{List is a list of rownumbers in the grid being sorted}
var
med_value : integer;
hi, lo, i : Integer;

function compare(val1,val2:string):integer;
var

int1,int2:integer;
float1,float2:extended;
errcode:integer;

begin

case datatype of
  0: result:=ANSIComparetext(val1,val2);
  1: begin
       int1:=strtointdef(val1,0);
       int2:=strtointdef(val2,0);
       if int1>int2 then result:=1
       else if int1<int2 then result:=-1
       else result:=0;
     end;

  2: begin
       val(val1,float1,errcode);
       if errcode<>0 then float1:=0;
       val(val2,float2,errcode);
       if errcode<>0 then float2:=0;
       if float1>float2 then result:=1
       else if float1<float2 then result:=-1
       else result:=0;
     end;
   else result:=0;
end;

end;

查看更多内容...