Delphi - Determinar Cuantas lineas tiene un Campo Memo.

 
Vista:

Determinar Cuantas lineas tiene un Campo Memo.

Publicado por Aqules Almanzar (36 intervenciones) el 02/10/2002 16:08:45
Mi problema es que necesito saber cuantas lineas tiene un campo memo.

Gracias....
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Determinar Cuantas lineas tiene un Campo Memo.

Publicado por Luck Ibarra (78 intervenciones) el 02/10/2002 19:12:04
Este ejemplo sirve para saber cuantas lineas caben en un Tmemo

procedure TForm1.Button1Click(Sender: TObject);

function LineasVisibles(Memo: TMemo): integer;
Var
Oldfont : HFont; {the old font}
DC : THandle; {Device context handle}
i : integer; {loop variable}
Tm : TTextMetric; {text metric structure}
TheRect : TRect;
begin
DC := GetDC(Memo.Handle);
try
OldFont := SelectObject(DC, Memo.Font.Handle);
try
GetTextMetrics(DC, Tm);
Memo.Perform(EM_GETRECT, 0, longint(@TheRect));
Result := (TheRect.Bottom - TheRect.Top) div
(Tm.tmHeight + Tm.tmExternalLeading);
finally
SelectObject(DC, Oldfont);
end;
finally
ReleaseDC(Memo.Handle, DC);
end;
end;
begin
Label1.Caption:=IntToStr(LineasVisibles(Memo1));
end;

Este ejmplo fue tomado de http://www.q3.nu/trucomania

Suerte
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Determinar Cuantas lineas tiene un Campo Memo.

Publicado por FJA (3 intervenciones) el 25/10/2002 21:06:46
Memo1.Lines.Count;
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar