请问如何获得TMemo上的可见行数 用它的高度除于字的高度和间隔 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function LinesVisible(Memo: TMemo): integer; Var OldFont : HFont; Hand : THandle; TM : TTextMetric; Rect : TRect; tempint : integer; begin Hand := GetDC(Memo.Handle); try OldFont := SelectObject(Hand, Memo.Font.Handle); try GetTextMetrics(Hand, TM); Memo.Perform(EM_GETRECT, 0, longint(@Rect)); tempint := (Rect.Bottom - Rect.Top) div (TM.tmHeight + TM.tmExternalLeading); finally SelectObject(Hand, OldFont); end; finally ReleaseDC(Memo.Handle, Hand); end; Result := tempint; end; edit没有属性可以设置只能输入数字吗?vc都有的阿。 最后的散分七号,先到先得。 在richedit中如何把指定的文字插入到光标所在的位置? 如何用循环的语句实现下面的语言 在怎样的需求下用B/S结构,怎样的需求下用三层结构? 怎样用delphi做快显窗口??? ADODataSet这样使用不可以吗? 请高手帮忙,读硬盘序列号出的怪问题 如何读写注册表 调用vc++动态连接库的,奇怪问题!这回我不能回去过年了! 怎样在TMemo组件上画图 为什么nmpop3收到的主题是乱码
Var
OldFont : HFont;
Hand : THandle;
TM : TTextMetric;
Rect : TRect;
tempint : integer;
begin
Hand := GetDC(Memo.Handle);
try
OldFont := SelectObject(Hand, Memo.Font.Handle);
try
GetTextMetrics(Hand, TM);
Memo.Perform(EM_GETRECT, 0, longint(@Rect));
tempint := (Rect.Bottom - Rect.Top) div
(TM.tmHeight + TM.tmExternalLeading);
finally
SelectObject(Hand, OldFont);
end;
finally
ReleaseDC(Memo.Handle, Hand);
end;
Result := tempint;
end;