惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
J
Java Code Geeks
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
M
MIT News - Artificial intelligence
U
Unit 42
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
I
InfoQ
WordPress大学
WordPress大学
H
Help Net Security
D
Docker
B
Blog
腾讯CDC
A
About on SuperTechFans
Recent Announcements
Recent Announcements
雷峰网
雷峰网
有赞技术团队
有赞技术团队
C
Check Point Blog
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

博客园 - 周黔

delphian firemonkey. android:exported 错误 RAD Studio 12 Delphi 12 实现手机无线wifi调试 (巧用Android Studio 2024 连WIFI) delphi 11 HMACSha512 Android Studio 2024 不需要三方插件,直接wifi 开发调试,真方便 CEF4Delphi(DELPHI Google Chrome 浏览器封装) 折腾 (2)--打开一个网页 CEF4Delphi(DELPHI Google Chrome 浏览器封装) 折腾 (1)--安装 Delphi WINAPI 任意拖动移动控件 DELPHI 调用标准C接口DLL char *value Apache NetBeans IDE 12.3 双击无反应怪事 [转]Regions and Clipping in GDI+ delphi 10.4 JSON 建立数组示例 delphi 10.3实现TNetHTTPClient 异步 POST 另类实现返回附加标记及Unicode 编码与解码 \u - 周黔 小程序开发笔记1 Delphi DLL 消息循环 Synchronize SendMessage PostMessage 用户中心 - 博客园 delphi 跨版本DLL调用嵌入窗体实现 DELPHI GDI + TGPFont UnitPixel 问题解决 delphi DLL image 动态绘图 句柄处理 delphi 每英寸相素点取值偏差
delphi firemonkey 12.3 动态绑定TFDMemTable到TStringGrid
周黔 · 2026-03-31 · via 博客园 - 周黔

//USES  哪些忘了,试验过程中,加了一大堆有用无用的

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Memo.Types,
  System.Rtti, FMX.Grid.Style, Data.Bind.EngExt, Fmx.Bind.DBEngExt,
  FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
  FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
  Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client, Data.Bind.Components,
  Data.Bind.DBScope, FMX.Grid, FMX.StdCtrls, FMX.Controls.Presentation,
  FMX.ScrollBox, FMX.Memo, FMX.Objects , Fmx.Bind.Grid, System.Bindings.Outputs
  , Data.Bind.Grid ,System.Bindings.Helper, FMX.ListBox, Data.Bind.Controls,
  FMX.Layouts, Fmx.Bind.Navigator
 , Fmx.Bind.Editors, Data.Bind.DBLinks, Fmx.Bind.DBLinks ,System.Math;


  DataSource1 : TDataSource;
  BindScopeDB1 : TBindScopeDB;
  FDData: TFDMemTable;//数据集查询过程,略

// memResult.Lines.Insert(0,'查询返回记录数:' +FDData.RecordCount.ToString );

 // 3. 初始化数据源
                      DataSource1 := TDataSource.Create(nil);
                      DataSource1.DataSet := FDData;

                      // 4. 初始化 LiveBindings 核心组件
                      BindScopeDB1 := TBindScopeDB.Create(nil);
                      BindScopeDB1.DataSource := DataSource1;

                      BindingsList1 := TBindingsList.Create(nil);
StringGrid1 := TStringGrid.Create(nil);
                      StringGrid1.Parent := Self; // 或指定其他容器
                      StringGrid1.Align := TAlignLayout.Client;
                      StringGrid1.Options := StringGrid1.Options + [TGridOption.RowSelect]; // 推荐设置为行选择

                      // 5. 创建并激活 Grid 与数据源的绑定
                      with TBindDBGridLink.Create(BindingsList1) do
                      begin
                          GridControl := StringGrid1;
                          DataSource := BindScopeDB1;
                          Active := True;
                      end;
                   //  AutoFitAllColumns(StringGrid1); //表头显示与后继处理