Recent

Author Topic: [SOLVED] TRichMemo Background  (Read 1839 times)

Badger

  • Jr. Member
  • **
  • Posts: 93
[SOLVED] TRichMemo Background
« on: August 27, 2021, 07:54:04 am »
Is it possible to set a 'clear' background for a Rich Memo.

I have a Rich Memo over the top of an image and I want the user to be able to see the image behind with the text over the top. Setting the Rich Memo brush style to clear doesn't work and there is no canvas for Rich Memo.
« Last Edit: September 08, 2021, 02:05:07 am by Badger »
Badger

If at first you don't succeed - you're running about average!

I'm using Windows 10 Lazarus v2.0.10

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2718
    • havefunsoft.com
Re: TRichMemo Background
« Reply #1 on: August 27, 2021, 08:10:19 am »
it's kinda yes, and kinda no :)

for Windows this what you might want to try:
Code: Pascal  [Select][+][-]
  1. uses
  2.   ... Windows...;
  3.  
  4. procedure TForm1.FormShow(Sender: TObject);
  5. var
  6.   l : Dword;
  7. begin
  8.   // Make sure that RichMemo1.Handle EXISTS! this operation HAS to be performed, if HANDLE is recreated
  9.   // Make sure there's TImage resides on the same form as RichMemo
  10.   l:= GetWindowLong(RichMemo1.Handle, GWL_EXSTYLE);
  11.   SetWindowLong(RichMemo1.Handle, GWL_EXSTYLE, l or WS_EX_TRANSPARENT);
  12. end;
  13.  
« Last Edit: August 27, 2021, 08:12:41 am by skalogryz »

Badger

  • Jr. Member
  • **
  • Posts: 93
Re: TRichMemo Background
« Reply #2 on: August 27, 2021, 09:38:07 am »
Thanks that works fine. :)
One other question, I'm planning to make this application available for Apple system, is it possible to do this on Apple platforms?
Badger

If at first you don't succeed - you're running about average!

I'm using Windows 10 Lazarus v2.0.10

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2718
    • havefunsoft.com
Re: TRichMemo Background
« Reply #3 on: August 27, 2021, 05:47:16 pm »
One other question, I'm planning to make this application available for Apple system, is it possible to do this on Apple platforms?
in theory, yes, it is possible.
Yet, it will be a different kind of code.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2718
    • havefunsoft.com
Re: TRichMemo Background
« Reply #4 on: September 04, 2021, 09:01:39 am »
a new property has been added:
https://wiki.freepascal.org/RichMemo#Transparent
It works for Win32, Cocoa and Qt5.

Should make your cross-platform life a little-bit easier.

 

TinyPortal © 2005-2018