Solved

RichEdit background

Posted on 1998-11-19
4
488 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

831 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