procedure TForm1.Button23Click(Sender: TObject); var ACol,ARow: integer; Str: string; R: TRect; begin for ACol:= 0 to StringGrid1.ColCount - 1 do for ARow:= 1 to StringGrid1.RowCount - 1 do begin Str:= StringGrid1.Cells[ACol,ARow]; UniqueString(Str); R:= StringGrid1.CellRect(ACol,ARow); DrawText(StringGrid1.Canvas.Handle, PChar(Str), Length(Str), R,DT_END_ELLIPSIS or DT_MODIFYSTRING ); StringGrid1.Cells[ACol,ARow]:= Str; end; end; 不知道合不合你要求,你试试吧
可能XP对长字符支持比较好
procedure TForm1.Button23Click(Sender: TObject);
var
ACol,ARow: integer;
Str: string;
R: TRect;
begin
for ACol:= 0 to StringGrid1.ColCount - 1 do
for ARow:= 1 to StringGrid1.RowCount - 1 do
begin
Str:= StringGrid1.Cells[ACol,ARow];
UniqueString(Str);
R:= StringGrid1.CellRect(ACol,ARow);
DrawText(StringGrid1.Canvas.Handle, PChar(Str), Length(Str), R,DT_END_ELLIPSIS or DT_MODIFYSTRING );
StringGrid1.Cells[ACol,ARow]:= Str;
end;
end;
不知道合不合你要求,你试试吧