Usando textwidth em vez de textextent funciona, mas com

lCol.Width := StringExtent(StringOfChar('Z', lFld.DisplayWidth),DBGrid1.Font)

as larguras (col widths) sao muito grandes, e se tento

lCol.Width := StringExtent(lFld.AsString,DBGrid1.Font)

as larguras sao muito pequenas.

Continuo a tentar . . . . . . .

Steve



-----Original Message-----
From: delphi-br@yahoogrupos.com.br
[mailto:delphi...@yahoogrupos.com.br]on Behalf Of Wilson, Stephen
Sent: 01 December 2009 09:20
To: delphi-br@yahoogrupos.com.br
Subject: RE: [delphi-br] Largura de colunas de DBGrid

Ate agora tenho tentado a sugestao de Rubem, mas recebo um erro "Incompatible 
types Integer and tagSize"  here:

if lFld is TNumericField then

      lCol.Width := StringExtent(lFld.EditMask, DBGrid1.Font)

else

      lCol.Width := StringExtent(StringOfChar('Z', 
lFld.DisplayWidth),DBGrid1.Font);

Vou continuar tentando . . . . . . 

Muito obrigado

Abracos

Steve



***************************************************************************

This e-mail and any files transmitted with it are confidential. If you are 
not the intended recipient, any reading, printing, storage, disclosure, 
copying or any other action taken in respect of this e-mail is prohibited 
and may be unlawful. If you are not the intended recipient, please notify 
the sender immediately by using the reply function and then permanently 
delete what you have received.

Content of emails received by this Trust will be subject to disclosure 
under the Freedom of Information Act 2000, subject to the specified 
exemptions, including the Data Protection Act 1998 and Caldicott Guardian 
principles.

This footnote also confirms that, unless otherwise stated, this email 
message has been swept by Sophos Anti-virus for the presence of computer 
viruses.

  ** Please consider the environment before printing this email. **

***************************************************************************

Responder a