Recent

Author Topic: How to pass the value of a MemoryStream to a Memo?  (Read 814 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: 2818
    • 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 -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

paule32

  • Hero Member
  • *****
  • Posts: 647
  • One in all. But, not all in one.
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.
MS-IIS - Internet Information Server, Apache, PHP/HTML/CSS, MinGW-32/64 MSys2 GNU C/C++ 13 (-stdc++20), FPC 3.2.2
A Friend in need, is a Friend indeed.

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1596
    • 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