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

    Changing background Color of CRect

    I have the code as below:
    Code:
    CRect textRect (10,20,30,40);
    CStatic *text = new CStatic;
    text->Create("Text",allstyle| SS_LEFT ,textRect,&m_Panel);
    Note: m_Panel is a scrollbarPanel

    Now question is background color of area covering text(texxtRect) is grey,i want to color it white.How to do it with above code?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Changing background Color of CRect

    Quote Originally Posted by Beginner_MFC View Post
    I have the code as below:
    Code:
    CRect textRect (10,20,30,40);
    CStatic *text = new CStatic;
    text->Create("Text",allstyle| SS_LEFT ,textRect,&m_Panel);
    Note: m_Panel is a scrollbarPanel

    Now question is background color of area covering text(texxtRect) is grey,i want to color it white.How to do it with above code?
    Learn how to create control variables. All this stuff you are asking for is the same. Create a control variable of the appropriate type and then use its methods.

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Changing background Color of CRect

    A CRect isn't a window. It has no color.

    You may want to read up on CWnd::OnCtlColor

Tags for this Thread

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