Hi everyone, I'm afraid there's no way to do this in .NET so I'm looking for a PInvoke solution. I have a WinForm TreeView. Some nodes in the tree have a red or yellow background color (based on some business logic) while other nodes have the default (white) background color. This part works fine. When the user selects a node, however, the background color of the node is always SystemColors.Highlight (a dark blue) while the node is selected, regardless of its pre-selected background color. I would like the background color of red or yellow nodes to be something other than dark blue when these nodes are selected. So basically, I am looking for a way to have three different "highlight colors" when a node is selected. The highlight color will be different for red, yellow or default nodes. Does anyone know of a PInvoke way to do this? Thank you -- Tom Baxter
Dear Tom, Thanks for your post, I find you have posted this issue on microsoft.public.dotnet.framework.windowsforms, and I have replied you there, so let's discuss there, I'll close this one. Sincerely, Zhi-Xin Ye Microsoft Managed Newsgroup Support Team Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com. ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Tom Baxter wrote: > Hi everyone, > > I'm afraid there's no way to do this in .NET so I'm looking for a PInvoke > solution. > > I have a WinForm TreeView. Some nodes in the tree have a red or yellow > background color (based on some business logic) while other nodes have the > default (white) background color. This part works fine. > > When the user selects a node, however, the background color of the node is > always SystemColors.Highlight (a dark blue) while the node is selected, > regardless of its pre-selected background color. I would like the background > color of red or yellow nodes to be something other than dark blue when these > nodes are selected. So basically, I am looking for a way to have three > different "highlight colors" when a node is selected. The highlight color > will be different for red, yellow or default nodes. > > Does anyone know of a PInvoke way to do this? I have no idea what PInvoke does, but I set the back colour by subclassing and handling the CustomDraw notification in the CDDS_ITEMPREPAINT stage by setting TVCD.clrTextBk. -- Dean Earley (dean.earley@icode.co.uk) i-Catcher Development Team iCode Systems