Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 513
  • Last Modified:

RichEdit background

Does anyone know if it is possible to put a background image behind a RichEdit control or a CRichEditView derived window.
I know how to change the background color, but need to place a bitmap behind the control.  Do I need the bitmap in a window behind the RichEdit one?

I need to make it look like the text is being typed over an image.  
0
shudecek
Asked:
shudecek
  • 2
1 Solution
 
cyrilbdtCommented:
ovveride OnEraseBkgnd and there draw your bitmap
0
 
mikeblasCommented:
Unfortunately, that won't work. If you're using CRichEditView, you're using RichEdit 1.0.  RichEdit 1.0 doesn't draw transparent text. You can't handle it's erase background, and you can't subclass it's painting to convince it to do so.

You're just out of luck.

RichEdit 2.0 can help you do what you want, but it is not yet supported by MFC.

B ekiM
0
 
shudecekAuthor Commented:
I tried that, I also tried overriding OnDraw, OnPaint, neither work.  I'll look more into RichEdit 2.0. Thanks
0
 
mikeblasCommented:
You'll find that you can simply override PreCreateWindow or Create to have it create the new class.  You'll also need to loadlibrary RICHEDIT20 instead of calling AfxInitRichEdit().

Depending on how aggressively you use the class, thogh, you might need to do more than override the creation and hcange the initialization--it's possible that you'll need to start from scratch. This much work can make the notion of haivng a background bitmap a little bit too expensive--and you you might want to reconsider that feature for your application.

B ekiM


0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now