Solved

Drawing a background in a CRichEditCtrl

Posted on 1998-03-24
7
1,715 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Named range not carried over 10 63
bigDiff challenge 17 106
pre4 challenge 19 100
Excel file not created as expected 7 72
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

770 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