Pessoal respondendo a minha propria pergunta no site
http://www.delphi3000.com/ eu achei um exemplo que era o que eu
porecisava... fiz uma modificacao nele e funciona beleza....
procedure SetOptimalGridCellWidth(sg: Tstringgrid;
colunas:array of integer);
var
c : Integer;
i : Integer;
j : Integer;
max_width : Integer;
begin
with sg do
begin
// If the grid's Paint method hasn't been called yet,
// the grid's canvas won't use the right font for TextWidth.
// (TCustomGrid.Paint normally sets this, under DrawCells.)
Canvas.Font.Assign(Font);
for c := 0 to length(colunas)-1 do
begin
i:= colunas[c];
max_width := 0;
// Search for the maximal Text width of the current column.
for j := 0 to (RowCount - 1) do
max_width := Math.Max(max_width,Canvas.TextWidth(Cells[i,j]));
// The hardcode of 4 is based on twice the offset from the left
// margin in Tstringgrid.DrawCell. GridLineWidth is not relevant.
if max_width > 0 then
ColWidths[i] := max_width + 4
else
ColWidths[i] := DefaultColWidth;
end; { for }
end;
end;
ArbSis escreveu:
> Pessoal como posso fazer para ajustar automaticamente o tamanho das
> colunas de um StringGrid conforme a quantidade de texto que cada celula
> possuir...
>
>
>
>
>
> _______________________________________________________
> Yahoo! Messenger com voz: PROMOÇÃO VOCÊ PODE LEVAR UMA VIAGEM NA
> CONVERSA. Participe! www.yahoo.com.br/messenger/promocao
>
>
> --
> <<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>
>
> Para ver as mensagens antigas, acesse:
> http://br.groups.yahoo.com/group/delphi-br/messages
>
> Para falar com o moderador, envie um e-mail para:
> [EMAIL PROTECTED] ou [EMAIL PROTECTED]
>
>
>
> *Yahoo! Grupos, um serviço oferecido por:*
> PUBLICIDADE
>
>
> ------------------------------------------------------------------------
> *Links do Yahoo! Grupos*
>
> * Para visitar o site do seu grupo na web, acesse:
> http://br.groups.yahoo.com/group/delphi-br/
>
> * Para sair deste grupo, envie um e-mail para:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
> * O uso que você faz do Yahoo! Grupos está sujeito aos Termos do
> Serviço do Yahoo! <http://br.yahoo.com/info/utos.html>.
>
>
_______________________________________________________
Yahoo! Messenger com voz: PROMOÇÃO VOCÊ PODE LEVAR UMA VIAGEM NA CONVERSA.
Participe! www.yahoo.com.br/messenger/promocao
--
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>
Para ver as mensagens antigas, acesse:
http://br.groups.yahoo.com/group/delphi-br/messages
Para falar com o moderador, envie um e-mail para:
[EMAIL PROTECTED] ou [EMAIL PROTECTED]
Links do Yahoo! Grupos
<*> Para visitar o site do seu grupo na web, acesse:
http://br.groups.yahoo.com/group/delphi-br/
<*> Para sair deste grupo, envie um e-mail para:
[EMAIL PROTECTED]
<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
http://br.yahoo.com/info/utos.html