Transparent RichEditCtrl

256 colors

Hicolor

Environment: VC5, NT4 SP3

CRichEditCtrlEx is derived from CRichEditCtrl and contains two methods for create the control.

The background of a rich control could be changed using SetBackgroundColor() method. When the display has 256 colors the RGB value from SetBackgroundColor() method is converted into an apropiate color from system palette. So I created a pattern brush with the desired RGB value with I filled the control in OnErasebkgnd() method. I have also treated the invalidate message because the control being transparent didn't actualize itself.

The first image is taken from a 256 color display adapter and the second from a 16 bit one.

The method MsgFilterRich() is used for treatment the mouse or key events.

Downloads

Download demo project - 23 KB


Comments

  • Transparency While The Window is Hidden

    Posted by Legacy on 05/02/2003 12:00am

    Originally posted by: TDS

    My Problem is I Want Text From The RichEditCtrl While the Window is Hidden With Transparent Backgrnd.
    For this Problem I Had Used Ur Code But While The Window is Hidden WM_PAINT Mesage Gets Posted Continously To The Parent Window .
    Regard
    TDS

    Reply
  • Could you tell me my mistake? Please~

    Posted by Legacy on 08/01/2001 12:00am

    Originally posted by: Moon Joon Sik

    error C2440: 'initializing' : cannot convert from 'class std::list<class CString,class std::allocator<class CString> >::const_iterator' to 'class std::list<class CString,class std::allocator<class
    CString> >::iterator'

    This is an error message. I don't know why error occur. Please teach me~ Have a good time~ Bye~

    Reply
  • Transparency in RichEdit2

    Posted by Legacy on 04/08/2001 12:00am

    Originally posted by: Anton Riabov

    Rich edit 2.0 (and higher) can be made transparent with WS_EX_TRANSPARENT style, and any kind of background can be put under it with minimal flickering, as long as parent window redraws only the modified rectangle. Hope this helps.

    Reply
  • Flicker on scroll

    Posted by Legacy on 08/12/1999 12:00am

    Originally posted by: Bob Cozzi

    The knowledge that we can use the transparent style is great. I've needed to draw (water mark style) for a long time.

    The problem is that when I use the transparent style, the scroll feature causes a mud slide. The text smears across the screen while it is scrolled, and never recovers.

    To resolve this I have to update the entire window, but the problem is, the Erase background routine causes the entire RichEdit control to blink. This is not acceptable. :(

    Redraw(FALSE) doesn't work and I can't seem to get at the RichEdit control's ITextDocument to try to do a Freeze() method. Very close, but for me it isn't working good enough. :( Any Ideas?

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

  • Live Event Date: August 14, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Data protection has long been considered "overhead" by many organizations in the past, many chalking it up to an insurance policy or an extended warranty you may never use. The realities of today make data protection a must-have, as we live in a data driven society. The digital assets we create, share, and collaborate with others on must be managed and protected for many purposes. Check out this upcoming eSeminar and join eVault Chief Technology …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds