PDA

View Full Version : dotNet ListView selected Items highlight goes from blue to tan


Hobbs
09-17-2008, 10:35 PM
Is there a way to keep the blue highlight after you lose focus of the controller?

I have my hideselection set to false, so it still shows what item is selected, it just switches from a blue to a tan, i believe from my system colors.

My version of the same tool in ActiveX kept the blue high light the whole time, controller in focus, or not in focus.

Has anyone found a work around for this, or am i missing something.

Thanks for your time.

RobGalanakis
09-17-2008, 10:55 PM
I'd like an answer to this as well... it is related to the system's colors, since if you switch your Settings (from XP Blue to Silver, or to Windows Classic, etc), it changes. I tried a few things but no cigar.

PEN
09-18-2008, 12:51 AM
The only thing that I have done to change this is to colour the background property of the listView item.

RobGalanakis
09-18-2008, 12:58 AM
The only thing that I have done to change this is to colour the background property of the listView item.

Isn't that overridden when it is selected, though?

PEN
09-18-2008, 10:39 AM
Sounds like he wants it the default color so it will not matter. Once focus is lost set te back ground color to the same as the selection color.

LoneRobot
09-18-2008, 12:44 PM
dotnet controls like listview and treeview have an ownerdraw property that allows to to pretty much draw the whole control from scratch. Setting this to true allows you to bypass windows drawing the control. You use the drawitem handler to specify background color, text color etc. The handler of this event contains a few useful properties - drawbackground, drawtext and bounds for example (which contains all the info of where the item is and how big it is)

PEN
09-18-2008, 03:00 PM
Oh nice, will have to have a poke at that in all my spare time:S

Hobbs
09-18-2008, 03:29 PM
thanks for leading me in the right direction guys.

Kameleon
09-18-2008, 06:46 PM
Just to add that for the TreeView the DrawMode property does the same for that control :)

CGTalk Moderation
09-18-2008, 06:46 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.