Microsoft KB Archive/216140

{|
 * width="100%"|

PRB: TreeView Ctrl Button Background Doesn't Change After TVM_SETBKCOLOR

 * }

Q216140

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK)

-

SYMPTOMS
In a TreeView control with the TVS_HASLINES and TVS_HASBUTTONS style, the background color behind the "+" and "-" buttons does not change when the background color of the control is changed with the TVM_SETBKCOLOR message.

RESOLUTION
After you change the background color of the TreeView control, remove the TVS_HASLINES style and add it again. The following code sample illustrates what you need to do to work around the problem:

LONG lStyle; // hWndTree is the handle of the TreeView control. TreeView_SetBkColor(hWndTree, clrNew); lStyle = GetWindowLong(hWndTree, GWL_STYLE); lStyle &= ~TVS_HASLINES; // Remove the TVS_HASLINES style. SetWindowLong(hWndTree, GWL_STYLE, lStyle); lStyle |= TVS_HASLINES; // Add the TVS_HASLINES style again. SetWindowLong(hWndTree, GWL_STYLE, lStyle); Additional query words:

Keywords : kbCtrl kbOSWinNT400 kbOSWin2000 kbSDKPlatform kbTreeView kbGrpDSUser kbOSWin95 kbOSWin98

Issue type : kbprb

Technology : kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch