Author Topic: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012  (Read 21301 times)

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
1st Small Example of a semi-transparent background image inside a richedit control.

Based on http://www.codeproject.com/Articles/11253/See-through-Rich-Edit-control

Problems:
* When you paste long text inside the richedit control and scroll up or down, the text is painted over itself (seems blurred). Don´t know how to solve yet. Maybe copying the DC somewhere or perhaps another WM_ERASEBKGND
* RosAsm can´t handle extended Dialog Styles yet.....So, i´ll rewrite this code to change the exstyle of the dialog. (This one was originated from a work of disassemblement process - All C++Classes where removed. Damn....i trully hate C++Classes :greensml:)

This is not exactly putting a image inside the background opf the RTF control, but effect seems nice.

Soon i´ll post another example of how to really insert a image as the background of a RichEdit Control.

Interesting examples on similiar subject:
http://www.codeguru.com/cpp/controls/staticctrl/datadisplaycontrols/article.php/c8829/Transparent-Static-Control.htm

Note for me:
Analyse this > http://www.codeguru.com/cpp/w-d/dislog/resizabledialogs/article.php/c1925/General-Flicker-Free-Resizable-Control.htm
http://www.codeguru.com/cpp/g-m/bitmap/article.php/c1753/Transparent-Bitmap--True-Mask-Method.htm

Example1: V 2.0 - Updated Version 16:48  27/08/2.012 - Fixed Mousewheel

Updated Version at 14:52 27/08/2.012 - Fixed invalidating desktop


Example2 28/08/2.012 - This one is really inserting a image inside the richedit control



Next Version. - I´ll try to adapt Iczelion Example 35 to this.
« Last Edit: August 29, 2012, 05:01:41 AM by guga »
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

qWord

  • Member
  • *****
  • Posts: 1475
  • The base type of a type is the type itself
    • SmplMath macros
Re: Transparent Background image in RichEdit
« Reply #1 on: August 28, 2012, 01:20:00 AM »
Not that good: it invalidates the whole desktop when typing text.
You may also take a look at DWM.
MREAL macros - when you need floating point arithmetic while assembling!

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: Transparent Background image in RichEdit
« Reply #2 on: August 28, 2012, 01:26:48 AM »
Hi Qword

you mean this?
http://dwm.suckless.org

I´m reading it, but didn´t understood what does this app.
Or you are talking about this screenshot ?
http://dwm.suckless.org/screenshots/dwm-20091201.png
If it is, i´ll take a look at the code
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

qWord

  • Member
  • *****
  • Posts: 1475
  • The base type of a type is the type itself
    • SmplMath macros
Re: Transparent Background image in RichEdit
« Reply #3 on: August 28, 2012, 01:30:50 AM »
Desktop Window Manager (DWM, available since windows vista)
MREAL macros - when you need floating point arithmetic while assembling!

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: Transparent Background image in RichEdit
« Reply #4 on: August 28, 2012, 01:51:27 AM »
Seems great, but, i don´t have vista here.

Does it have something similiar in XP ?
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: Transparent Background image in RichEdit
« Reply #5 on: August 28, 2012, 03:54:54 AM »
FIXED invalidating desktop.

Now, the problem remains in the painting the control when scroll with the mousewheel.

If someone knows how to fix it, please let me know.


Why if i roll up and down the text using the scrollbar the text is ok, and when i do the samething using mousewheel and key up/down it paints the text over itself ?
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: Transparent Background image in RichEdit - Update 27/08/2.012
« Reply #7 on: August 28, 2012, 05:41:31 AM »
Updated Version at 16:38 27/08/2.012 - Fixed mousewheel scroll
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: Transparent Background image in RichEdit - Update 27/08/2.012
« Reply #8 on: August 29, 2012, 04:49:09 AM »
Other example. This time using really a image inside a richedit.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
i am still trying to figure out where the scroll bar is   :lol:

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Since the text is smaller then the client area, the scroll will not show.

for version1 just copy and paste a large text and the scroll will show up

for version2 just keep pressing enter on the rtf edit and the scroll will also show.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
A richedit with a Iricheditole interface could be of good use to change the background with an image
copy paste the image to a richedit holding the Iricheditole interface.
That all.
Some where on the forum,there is an richedit source code who do this.
« Last Edit: August 29, 2012, 10:57:48 PM by ToutEnMasm »
Fa is a musical note to play with CL

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
I have put it at a better place than before.
http://masm32.com/board/index.php?topic=646.0

Copy the image from this post and paste it to this demo program (after have initialised OLE in the menu "fichiers"
The save menu (enregistrer sous) need a litlle modify to save the image.

Fa is a musical note to play with CL

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
If the method exposed here work:
http://proger.i-forge.net/RichEdit_with_transparent_background_in_Delphi_Hell_yes/OVP
There is just to made a transparent richedit and create a control with one image.
Play with the prioritie styles like TOPMOST or another and you wil have a good result.
 
Fa is a musical note to play with CL

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm

Always more simple.
Here is a demo program who is near the soluce.
He allow to read a file with an image as background.
Method is simple.
give the WS_EX_TRANSPARENT style to the rich edit.
Draw the image in the windows ,paint message.
Open a file,read it,and view what happend when you press return.
The text in the upper part of the cusror is not refresh and couldn't be see until you made a scroll of the text.
Add a paint message after the return key and all will be good.




Fa is a musical note to play with CL