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. Background color of CListCtrl

Background color of CListCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelpquestion
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.
  • S Offline
    S Offline
    skfnmuisl dmufa oi
    wrote on last edited by
    #1

    I'm using a CListView-derieved class which displays SQL-results in report style. I decided to turn the background gray, so I called SetBkColor() in OnInitialUpdate. The problem is, that this backgroundcolor can only be seen in areas, where no items are draw and as a flickering background when scrolling the list. :confused: What must be done to override the standard item background color? Pseudocode is code to demonstrate a concept, not designed to be run. Like certain Microsoft software.

    T 1 Reply Last reply
    0
    • S skfnmuisl dmufa oi

      I'm using a CListView-derieved class which displays SQL-results in report style. I decided to turn the background gray, so I called SetBkColor() in OnInitialUpdate. The problem is, that this backgroundcolor can only be seen in areas, where no items are draw and as a flickering background when scrolling the list. :confused: What must be done to override the standard item background color? Pseudocode is code to demonstrate a concept, not designed to be run. Like certain Microsoft software.

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      The message to handle is WM_ERASEBKGND. Tomasz Sowinski -- http://www.shooltz.com

      S 1 Reply Last reply
      0
      • T Tomasz Sowinski

        The message to handle is WM_ERASEBKGND. Tomasz Sowinski -- http://www.shooltz.com

        S Offline
        S Offline
        skfnmuisl dmufa oi
        wrote on last edited by
        #3

        Sorry, but it doesn't help me. On handling this message, i can decide to paint or not paint the background. This is well doing, and my desired black background is already painting but not at the items background. That is my problem. The areas, where no item is 'overpainting' are black. Any idea? -------------------------------------------------- "Pseudocode is code to demonstrate a concept, not designed to be run. Like certain Microsoft software. "

        T 1 Reply Last reply
        0
        • S skfnmuisl dmufa oi

          Sorry, but it doesn't help me. On handling this message, i can decide to paint or not paint the background. This is well doing, and my desired black background is already painting but not at the items background. That is my problem. The areas, where no item is 'overpainting' are black. Any idea? -------------------------------------------------- "Pseudocode is code to demonstrate a concept, not designed to be run. Like certain Microsoft software. "

          T Offline
          T Offline
          Tomasz Sowinski
          wrote on last edited by
          #4

          Use identical color with LVM_SETBKCOLOR and LVM_SETTEXTBKCOLOR (or CListCtrl::SetBkColor/SetTextBkColor if you're using MFC):

          CListCtrl &lst = ...;
          lst.SetBkColor(RGB(255, 0, 0));
          lst.SetTextBkColor(RGB(255, 0, 0));

          This should make all background red. Tomasz Sowinski -- http://www.shooltz.com

          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