Krypton-Suite-Legacy-Archive/Krypton-NET-5.470

[Question] Changing the Hot Tracking colour?

Closed this issue · 13 comments

Hi all,

This is a really great library for UI in C# and I have been using/learning it as best as possible. Thanks to all who contributed.

I have a rather embarrassing question however, related to the colour scheme. I have tried to trace the code, but for the life of me, I cannot see how or where to change the button hot tracking colour (yellow) that seems to apply no matter which theme is selected.

I'm sure I've missed something simple and obvious (except for me!), would be grateful for any hints, pointers or guidance from the experts?

Thanks again

Hi @laythea

Thanks for your question, I think that I'm currently addressing your query here. The current property layout is quite confusing, as everything is hidden from the user in sub trees! My aim for issue #89 is to expose these properties to the developer.

Hi @Wagnerp,

Thanks for your quick reply. I have a hacked up version of the original krypton + some manually pulled in mods from here and there, so I have a slightly "messy" code base shall we say :)

Based on what I read, I have tried to find StateCommon in the hope that it would lead me to somewhere that specifies this colour. I am completely bamboozled, as I cannot find it anywhere. I also did a search for .XML files, thinking it may be in an XML file, but I could not see it there. I like to think I'm normally good at tracing these kind of things, but maybe not! :)

I do aim to rip it all out and replace with the updated libraries, but I have built an application already with the version of Krypton I have, so I am leaving that task until a bit later, when I have finished most of the core application.

Is there somewhere I can go in a poke a new RGB value? Is it specified per control/per theme/or globally?

Many thanks again

Hi @laythea

What you need to alter is the StateTracking properties (I think). Hopefully I can release the update in October that will expose the hidden properties.

Hi @Wagnerp
Thanks for the steer, I will report back if/when I find it! :)

Hi @laythea

I can confirm that it's StateTracking, just tested it myself :)

Ok I found it!

In my application, I'm using only the different variants of the Office 2010 theme. For any Office2010 based themes, the highlight colour seems to be done somewhat globally (for all Office2010 themes) and can be found at PaletteOFfice2010Base.cs in the _buttonBackColors colours array.

The highlight colour does not seem global (to all the controls), so I will probably need to find similar entries for each control (Eg treeview selected item).

Also, I need to expand this out somehow so that each different coloured Office2010-based theme can have its own highlight colour.

Thanks for the pointer which made me find it :)

Hi @Wagnerp

Sorry I just read your comment. I tried to search for StateTracking, but I could not find the RGB values, which seem to be held in the file I detailed in my comment above.

Is there another way/place to change these RGB values?

Hi @laythea

What version are you using? I don't think that there are any ways to alter these values in older versions, but I've been developing a 'new' library in my extended project which makes altering these values way easier. For the moment you can plug in a RGB value in the StateTracking > Back > Color1 & Color2 fields.

Hi @Wagnerp

I started with the original version, then I realised you guys were doing some cool stuff, but I had already got some way into my application. Nevertheless, I ripped out the old lib and put in the new extended one (I think the shadowed forms sold me :), but then some things did not seem to work (probably because of the way I was using it) eg combo boxes, so I then took the original files (where discrepancies where found like the combo box) and replaced only those files with the original version.

So I have a bit of a Frankenstein monster of a Krypton lib, which I readily admit to making worse by performing the RGB poke values as above. I have also found some visual glitches such as ribbon button tracking state drawing a white border around buttons, even when I specify no border, so have had to hack the code a bit also.

I get frustrated with it a bit, because I am developing an app, but found myself fighting the lib a bit. It boils down to my lack of knowledge of Krypton though, but as I'm doing an app, I want to try (its difficult, because all the UI stuff is interesting) to avoid spending too much time in the library/understanding the internals of the lib. This is why I know I'm committing a wrong by hacking up the lib to do the job, but I will accept my behaviour because its a means to an end kind of thing.

I definitely want to, at some point, rip my hack out again, and try to integrate Krypton unmodified. So that I can take advantage of all the awesome work you guys are doing.

Thanks

Hi @laythea

Have you tried looking at the KryptonPalette component? If you want, I can attach the new library that I've created, which allows granular control (it's still under development, but stable)?

Hi @Wagnerp

No I wasn't aware of KryptonPalette. So far, I've been modifying PaletteOffice2010Base.cs and then I copied the PaletteOffice2010Black.cs file to create my own colours. It seems very complex the way colours are determined (palette redirection etc), but it is caused by my lack of understanding mainly. The debugger has been my best friend :)

Is there any docs re palettes etc? Now that you have mentioned it, I will do some digging on KryptonPalette. Is KryptonPalette related to eg PaletteOffice2010Base.cs?

That would be great for your new library thanks, I would appreciate anything that may help! :)

Cheers

Hi @laythea

Attached is the chm help file that was included with v4.4.0 here. What version of the .NET Framework are you using, so that I can give you the correct version?

Hi @Wagnerp

Thanks very much for the link. I am using .NET 4.0, but will probably re-target the projects to 4.7 to get the high DPI awareness stuff. (haven't got onto testing that aspect yet :)

Thanks again!