The MASM Forum

Projects => Rarely Used Projects => RosAsm => Topic started by: guga on August 28, 2012, 12:57:43 AM

Title: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: guga on August 28, 2012, 12:57:43 AM
1st Small Example of a semi-transparent background image inside a richedit control.
(http://i45.tinypic.com/34yv3iq.gif)
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

(http://masm32.com/board/Themes/default/images/post/clip.gif) Example1: V 2.0 - Updated Version 16:48  27/08/2.012 - Fixed Mousewheel (http://masm32.com/board/index.php?action=dlattach;topic=638.0;attach=513)

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


(http://masm32.com/board/Themes/default/images/post/clip.gif)Example2 28/08/2.012 - This one is really inserting a image inside the richedit control (http://masm32.com/board/index.php?action=dlattach;topic=638.0;attach=520)
(http://i45.tinypic.com/2ztdqua.jpg)


Next Version. - I´ll try to adapt Iczelion Example 35 to this.
Title: Re: Transparent Background image in RichEdit
Post by: qWord 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.
Title: Re: Transparent Background image in RichEdit
Post by: guga 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
Title: Re: Transparent Background image in RichEdit
Post by: qWord on August 28, 2012, 01:30:50 AM
Desktop Window Manager (http://msdn.microsoft.com/en-us/library/windows/desktop/aa969540(v=vs.85).aspx) (DWM, available since windows vista)
Title: Re: Transparent Background image in RichEdit
Post by: guga on August 28, 2012, 01:51:27 AM
Seems great, but, i don´t have vista here.

Does it have something similiar in XP ?
Title: Re: Transparent Background image in RichEdit
Post by: guga 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 ?
Title: Re: Transparent Background image in RichEdit - Update 27/08/2.012
Post by: guga on August 28, 2012, 05:06:06 AM
I found these but seems useless here
http://www.vbforums.com/showthread.php?352814-RESOLVED-Capture-Scroll-Event-of-RichTextBox
Title: Re: Transparent Background image in RichEdit - Update 27/08/2.012
Post by: guga on August 28, 2012, 05:41:31 AM
Updated Version at 16:38 27/08/2.012 - Fixed mousewheel scroll
Title: Re: Transparent Background image in RichEdit - Update 27/08/2.012
Post by: guga on August 29, 2012, 04:49:09 AM
Other example. This time using really a image inside a richedit.
Title: Re: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: dedndave on August 29, 2012, 10:52:40 AM
i am still trying to figure out where the scroll bar is   :lol:
Title: Re: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: guga on August 29, 2012, 04:50:17 PM
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.
Title: Re: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: TouEnMasm on August 29, 2012, 09:53:45 PM
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.
Title: Re: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: TouEnMasm on August 29, 2012, 10:21:26 PM
I have put it at a better place than before.
http://masm32.com/board/index.php?topic=646.0 (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.

Title: Re: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: TouEnMasm on August 29, 2012, 11:41:15 PM
If the method exposed here work:
http://proger.i-forge.net/RichEdit_with_transparent_background_in_Delphi_Hell_yes/OVP (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.
 
Title: Re: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: TouEnMasm on August 30, 2012, 11:13:04 PM

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.




Title: Re: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: Farabi on September 30, 2012, 01:23:22 PM
Look good guga. Thanks.  :t
Title: Re: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: guga on November 21, 2012, 01:54:51 PM
Hi farabi

many thanks :)
Title: Re: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: Farabi on January 23, 2013, 02:10:54 PM
interesting. im marking this thread.
Title: Re: Transparent Background image in RichEdit (2 Examples) - Update 28/08/2.012
Post by: dedndave on January 23, 2013, 04:25:51 PM
i might like to do different background colors on different lines of a control for a future project
i will keep your example in mind, Gustavo  :t