Ver Mensaje Individual
  #2  
Antiguo 08-08-2007
Avatar de ixMike
ixMike ixMike is offline
Miembro
 
Registrado: feb 2004
Posts: 1.151
Reputación: 22
ixMike Va por buen camino
Hola.

Para saber el ancho de un ListBox yo utilizo esto:

Código Delphi [-]
Procedure TForm1.Button1Click(Sender: TObject);
var ancho, n: integer;
begin
ancho:=0;
for n:=0 to ListBox1.Items.Count-1 do
 if ListBox1.Canvas.TextWidth(ListBox1.Items[n])>ancho then
  ancho:=ListBox1.Canvas.TextWidth(ListBox1.Items[n]);
ListBox1.Width:=Ancho;
end;

Espero que te sea de ayuda.

Saludos
Responder Con Cita