Solved

Drawing a background in a CRichEditCtrl

Posted on 1998-03-24
7
1,721 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
matchUp  challenge 6 68
How to convert MFC::CString to UTF8 wchar_t* 10 276
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 824
Capture logon name 13 86
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.

790 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