Recent

Author Topic: How to pass the value of a MemoryStream to a Memo?  (Read 421 times)

ReinaldoDuvida

  • Newbie
  • Posts: 6
How to pass the value of a MemoryStream to a Memo?
« on: April 15, 2024, 04:30:41 pm »
I'm saving an image in a MemoryStream variable, now I need to pass the value of this variable to a Memo. How do I do this?

cdbc

  • Hero Member
  • *****
  • Posts: 1165
    • http://www.cdbc.dk
Re: How to pass the value of a MemoryStream to a Memo?
« Reply #1 on: April 15, 2024, 04:45:20 pm »
Hi
Memo1.LoadFromStream(SomeMemoryStream);
...BUT why would you want to do that?!?
TMemo can't handle images...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

paule32

  • Full Member
  • ***
  • Posts: 233
Re: How to pass the value of a MemoryStream to a Memo?
« Reply #2 on: April 15, 2024, 05:31:25 pm »
you could sub class the TMemo, and write the Timage as background for the TMemo
with override the protected Paint method.

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1322
    • Lebeau Software
Re: How to pass the value of a MemoryStream to a Memo?
« Reply #3 on: April 15, 2024, 05:46:29 pm »
I'm saving an image in a MemoryStream variable, now I need to pass the value of this variable to a Memo. How do I do this?

A Memo can display only text.  What is your goal exactly?

Do you want to display the actual image?  Use TImage instead.

Do you want to see a textual representation of the raw bytes of the image?  Then hex-encode the bytes and display that instead.

Please clarify.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

 

TinyPortal © 2005-2018