Solved

Drawing a background in a CRichEditCtrl

Posted on 1998-03-24
7
1,709 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand data scrubbing tool 13 32
Complete beginner needs help making a cron job 9 110
fizzArray  challenge 1 63
has77  challenge 9 73
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

895 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

12 Experts available now in Live!

Get 1:1 Help Now