Click to See Complete Forum and Search --> : CEdit Control


Pashka
May 16th, 1999, 12:16 PM
Hi all!

I have the following problem: I have a CEdit control with a bitmap on
its background.
I made a CEdit derived class CMyEdit for this purpose.
Now, two threads of the problem are:

1. If a put the background when overriding OnEraseBkgnd in CMyEdit,
then the text is displayed well, but the space right under the text
is painted white, not bitmap I want. (CDC::SetBkMode(TRANSPARENT) for
the relevant CDC doesnot work)

2. If I put the background when overridinf CtrlColor in CMyEdit,
then the space under the text is painted correctly, but only current
line of the text is painted - all the rest disappears.

Please tell me what the problem in what I do, or if you know a sample
of CEdit ctrl with a bitmap beneath, please tell me.

TAT,
Pashka

G-Force
May 17th, 1999, 03:56 AM
Hi,
this is Max. I had a such a problem, too. I did the following:

I overwrote the DefaultWindowProc for my derived class. After the handling of the WM_PAINT message, I mix the Bitmap together with the text with a simple CDC::BitBlt command. Here You must create a Brush from a Bitmap and then use the MERGECOPY flag.
You´ll understand, what I mean, if You look into the Online-Help of MFC under CDC::BitBlt.

It´s a simple trick, but it works.

Ciao