Solved

Drawing a background in a CRichEditCtrl

Posted on 1998-03-24
7
1,703 Views
Last Modified: 2013-11-19
How can I put a bitmap background in a CRichEditCtrl while still allowing the control to draw its text normally over the background?
0
Comment
Question by:dabbler
7 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1317188
Try to override WM_ERASEBKGND message and paint background with your bitmap.
0
 
LVL 1

Author Comment

by:dabbler
ID: 1317189
I've already tried that, and it doesn't work.  The background gets painted with the bitmap, and is then covered over with a white background for the text.
0
 
LVL 8

Expert Comment

by:gelbert
ID: 1317190
Just an idea. Try to create CStatic control with the same coordinates as your CRichEditCtrl and display whatever image you want inside it. this part is easy. Then create CRichEditCtrl with transparent background. Result should make an impression of CRichEditCtrl with image on background. Good luck
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:dabbler
ID: 1317191
Thanks, but I've tried that one too...no dice.
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 250 total points
ID: 1317192
You'll not accomplish what you want with CRichEditCtrl (or CRichEditView) directly. MFC uses the Windows-supplied RichEdit Control 1.0, and that version of the control ignores the WS_EX_TRANSPARENT style and erases the background during WM_PAINT isntead of WM_ERASEBKGND.

You can sublcass CRichEditCtrl to use RichEdit 2.0 or 3.0 directly; you'll need to have your class initialize the correct DLL and create a control with the appropriate class name for the version of the control you want: it's all documented in the SDK.

Most of the messages you'll send to the control are the same no matter what versio no the control you're using, but most of the strucutres you get from or pass to the control are different. I can't remember if the newer versions of the control are backward-compatible with the old structures (I _think_ they are) but if you run into problems you'll have to avoid the MFC code and send raw messages yourself.

.B ekiM

0
 
LVL 1

Author Comment

by:dabbler
ID: 1317193
Thanks!  What version of the COMCTL lib do I need for 2.0/3.0?
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1317194
The RichEdit control isn't supplied by COMCTL32.DLL; it's supplied by RICHEDIT.DLL.  You'll find plenty of information on the different DLL versions and the class names that invoke them in the SDK documentation.

.B ekiM
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video discusses moving either the default database or any database to a new volume.

705 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now