我想新的TEdit作以下的事:
var i, j, StrCount : Integer;
tmpStr, ResultStr,Fin : String;
begin
if (SetDorllor) and (Self.Text <> '') then
begin
inherited;
tmpStr := Self.Text;
For j := 1 to Length(tmpStr) do
begin
if tmpStr[j] = ',' then
Delete(tmpStr,j,1);
end; //在改变数字时删除原来的','重新执行.
While Length(tmpStr) > 3 do
begin
StrCount := Length(tmpStr);
if StrCount > 3 then
begin
For i := StrCount -2 to StrCount do
begin
ResultStr := ResultStr + tmpStr;
end;
ResultStr :=',' + ResultStr;
Fin := ResultStr + Fin;
ResultStr := '';
Delete(tmpStr,StrCount-2,3);
end;
end; //while
Self.text :=tmpStr + Fin;
end;