CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: CEdit Control

  1. #1
    Join Date
    May 1999
    Posts
    38

    CEdit Control


    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


  2. #2
    Join Date
    May 1999
    Posts
    2

    Re: CEdit Control

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured