Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Setting Background Color of a CRichEdit

Setting Background Color of a CRichEdit

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi, After I create and populate the my Rich Edit there is light blue Back ground when I hit enter it goes away I was hoping the Following code snipet would solove the problem it hasn't the rich edit is completely coverd up

    CDC *richdc = Myrich->GetDC();
    COLORREF prevcolor, currcolor;
    currcolor = RGB(255,255,255);
    prevcolor = richdc->SetBkColor(currcolor);

    L 1 Reply Last reply
    0
    • F ForNow

      Hi, After I create and populate the my Rich Edit there is light blue Back ground when I hit enter it goes away I was hoping the Following code snipet would solove the problem it hasn't the rich edit is completely coverd up

      CDC *richdc = Myrich->GetDC();
      COLORREF prevcolor, currcolor;
      currcolor = RGB(255,255,255);
      prevcolor = richdc->SetBkColor(currcolor);

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Don't paint controls in random places, it will never have the results you want. You should only do it in response to WM_PAINT messages, which are usually handled in the OnDraw or OnPaint method.

      F 1 Reply Last reply
      0
      • L Lost User

        Don't paint controls in random places, it will never have the results you want. You should only do it in response to WM_PAINT messages, which are usually handled in the OnDraw or OnPaint method.

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        Hi, I don't have a message map for my rich edit so this the code for OnPaint for the Parent Dialog After I streamin my data the data is displayed with a thin blue background this backgrounds surrounds just this text so I when I streamin 2 lines there is blue background white line following it. next line of text surrounded by the blue background I am trying to get rid of blue background when I inserted the OnPaint the entire rich edit is covered up

        afx_msg void Show_storage::OnPaint()
        {
        CPaintDC richdc(Myrich);
        richdc.SetBkColor(RGB(255,255,255));

        }

        L 1 Reply Last reply
        0
        • F ForNow

          Hi, I don't have a message map for my rich edit so this the code for OnPaint for the Parent Dialog After I streamin my data the data is displayed with a thin blue background this backgrounds surrounds just this text so I when I streamin 2 lines there is blue background white line following it. next line of text surrounded by the blue background I am trying to get rid of blue background when I inserted the OnPaint the entire rich edit is covered up

          afx_msg void Show_storage::OnPaint()
          {
          CPaintDC richdc(Myrich);
          richdc.SetBkColor(RGB(255,255,255));

          }

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Like I said before, you cannot just paint into a control as and when you like. You must only do it in its OnPaint member function.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups