2012-05-14 7 views
7

Delphi XE2を使用してVCL win32アプリケーションを作成しています。 Delphi XE2はライブバインドをサポートしています。サンプルBiolife.xmlをTClientDataSetインスタンスにロードします。ライブバインディングを使用してBLOBフィールドをTImageコントロールにバインドする方法は?

データセットの文字列フィールドにTEDIT制御を結合することができるI:種名:

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

私はその後、TImageのコントロールにグラフィックフィールドをバインドしようとしている:

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

どうやら、そうでありません作業。それは可能ですか?

答えて

7

BindLinkVCLProjectデモプロジェクトをご覧ください。そこにも、画像のバインディング示したので、私の推測では、あなたがこのようにそれを行う必要があるさ(SourceExpressionSelfは、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 
関連する問題