Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

RichEdit background

Posted on 1998-11-19
4
489 Views
Last Modified: 2012-05-05
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
Comment
Question by:shudecek
  • 2
4 Comments
 
LVL 2

Expert Comment

by:cyrilbdt
ID: 1178281
ovveride OnEraseBkgnd and there draw your bitmap
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1178282
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
 

Author Comment

by:shudecek
ID: 1178283
I tried that, I also tried overriding OnDraw, OnPaint, neither work.  I'll look more into RichEdit 2.0. Thanks
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 50 total points
ID: 1178284
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question