加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – 如何使用实时绑定将blob字段绑定到TImage控件?

发布时间:2020-12-15 04:18:45 所属栏目:大数据 来源:网络整理
导读:我正在使用Delphi XE2编写VCL win32应用程序. Delphi XE2支持实时绑定.我将示例Biolife.xml加载到TClientDataSet实例中. 我能够将TEdit控件绑定到数据集的字符串字段:Species Name: object BindLinkEdit11: TBindLink Category = 'Links' SourceMemberName
我正在使用Delphi XE2编写VCL win32应用程序. Delphi XE2支持实时绑定.我将示例Biolife.xml加载到TClientDataSet实例中.

我能够将TEdit控件绑定到数据集的字符串字段:Species Name:

object BindLinkEdit11: TBindLink
  Category = 'Links'
  SourceMemberName = 'Species Name'
  ControlComponent = Edit1
  SourceComponent = BindScopeDB1
  ParseExpressions = <>
  FormatExpressions = <
    item
      ControlExpression = 'Text'
      SourceExpression = 'DisplayText'
    end>
  ClearExpressions = <>
end

然后我尝试将Graphic字段绑定到TImage控件:

object BindLinkImage11: TBindLink
  Category = 'Links'
  SourceMemberName = 'Graphic'
  ControlComponent = Image1
  SourceComponent = BindScopeDB1
  ParseExpressions = <>
  FormatExpressions = <
    item
      ControlExpression = 'Picture'
      SourceExpression = 'Value'
    end>
  ClearExpressions = <>
end

显然,它不起作用.这可能吗?

解决方法

看一下BindLinkVCLProject演示项目.还显示了图像的绑定,所以我猜你需要这样做(SourceExpression中的Self代表一个blob字段):
object BindLinkImageHandler: TBindLink
  Category = 'Links'
  SourceMemberName = 'Graphic'
  ControlComponent = Image1
  SourceComponent = BindScopeDB1
  ParseExpressions = <
    item
      ControlExpression = 'Picture'
      SourceExpression = 'Self'
    end>
  FormatExpressions = <
    item
      ControlExpression = 'Picture'
      SourceExpression = 'Self'
    end>
  ClearExpressions = <
    item
      ControlExpression = 'Picture'
      SourceExpression = 'nil'
    end>
end

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读