DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: melqui
今日帖子: 23
在线用户: 17
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 huangxing (gx) ★☆☆☆☆ -
盒子活跃会员
2022/1/24 12:40:30
标题:
FMX 有没有自动适应行高的数据Grid? 浏览:973
加入我的收藏
楼主: 我用ListView1显示出数据库内容,数据内容也可以换行,但是有个问题,好像行高没有办法自动适应,只能每行固定高度,如果数据量在设定高度内换行后放不下了,就只能堆在一起了,有没有可以自适应高度的控件呢?
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/1/24 12:57:39
1楼: you can use "UpdatingObjects" event to change the "height" of each "item"
or you can use your "Before" events in your Dataset to read the record and determine the "ListView item" height when reading the datas.

screenshot
此帖子包含附件:
PNG 图像
大小:30.9K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 sail2000 (小帆工作室) ★☆☆☆☆ -
盒子活跃会员
2022/1/24 13:23:49
2楼: 官方 Demo\VariableHeightItems 啊...
----------------------------------------------
delphi 是兴趣,和工作无关,即使它倒闭。又不靠它 delphi 吃饭,怕甚?
作者:
男 huangxing (gx) ★☆☆☆☆ -
盒子活跃会员
2022/1/24 14:08:44
3楼: 谢谢各位大神,根据官方demo可以搞定,宽度固定,高度可以根据内容自动适应。
procedure TForm74.ListView2UpdateObjects(const Sender: TObject;
  const AItem: TListViewItem);
  var
   getstr,Text:string;
   Drawable: TListItemText;
begin
  Drawable := TListItemText(AItem.View.FindDrawable('Text1'));
  Text := Drawable.Text;

  AItem.Height := GetTextHeight(Drawable, 199, Text);
  Drawable.Height := AItem.Height;
  Drawable.Width := 199;
end;
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行175.7813毫秒 RSS