CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007
    Posts
    52

    Unhappy CStatic-Derived class won't paint background

    Last post wasn't clear enough.

    I need to paint the background of a CStatic control created dynamically this way:

    -----------Code Snippet:------------------

    CUnknownCtrl* pUnknown;
    pUnknown = new CUnknownCtrl;
    pUnknown->Create("Text", SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, CRect(11,35,360,526), this, 0x31);
    ----------------------------------------------

    Notice that CUnknownCtrl is a CStatic-derived mfc class.

    I can't figure out how to set background color of the label created with this code, someone can help me?
    Calling OnCtlColor inside CUnknownCtrl won't even be executed and OnPaint fails. Some idea?

    Thanks for advance

  2. #2
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: CStatic-Derived class won't paint background

    Handle WM_ERASEBKGND in the CUnknownCtrl class

  3. #3
    Join Date
    Jul 2007
    Posts
    52

    Re: CStatic-Derived class won't paint background

    Thanks!

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