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

我正在使用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

相关文章

 从网上看到《Delphi API HOOK完全说明》这篇文章,基本上都...
  从网上看到《Delphi API HOOK完全说明》这篇文章,基本上...
ffmpeg 是一套强大的开源的多媒体库 一般都是用 c/c+&#x...
32位CPU所含有的寄存器有:4个数据寄存器(EAX、EBX、ECX和ED...
1 mov dst, src dst是目的操作数,src是源操作数,指令实现的...