Background color of CListCtrl
-
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.
-
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.
The message to handle is WM_ERASEBKGND. Tomasz Sowinski -- http://www.shooltz.com
-
The message to handle is WM_ERASEBKGND. Tomasz Sowinski -- http://www.shooltz.com
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. "
-
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. "
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