Can I retrieve Filename for TPicture directly?

后端 未结 3 1936
小蘑菇
小蘑菇 2020-12-12 05:56

I have a Delphi application which displays an image using a TImage.

The location of the image is stored in a database and retrieved on load and set directly using co

相关标签:
3条回答
  • 2020-12-12 06:04

    You can store the filename in the Hint property of Image1.

    if you don't already use it. As intended or for another purpouse... I find this property pretty promiscuous :)

    0 讨论(0)
  • 2020-12-12 06:11

    You can store the filename in the TagString property of Image1.

    if you don't already use it.

    (in Firemonkey, not VCL)

    0 讨论(0)
  • 2020-12-12 06:18

    No, there isn't. You can store it yourself, though.

    var
      ImageFileName: string;
    
    
    begin
      ImageFileName := Query1.FieldByName('image').AsString;
      Image1.Picture.LoadFromFile(ImageFileName);
    end;
    

    Declare the ImageFileName variable at a place where it will be visible everywhere you need access to the file name.

    0 讨论(0)
提交回复
热议问题