A common way to display an image is to provide a bitmap and then change the color of the image depending on the state of the content. Until now that was not possible with the Krypton Toolkit.

For example, you have a KryptonButton instance and you want to assign an image for display. The image is just a simple black cross used to represent a close action. When the user moves the mouse over the button you want the button to change to red and when pressed down it should become blue.

Previously you could not achieve this because you can only specify a single image for the KryptonButton and not an image per button state. There already exists the ImageEffect property for altering the image colors but this alters all the colors in the image. This is useful for showing an image disabled or lighter/darker, but it does not allow you to specify a fine grain change in an individual color.

So now I have added two new properties called ImageColorMap and ImageColorTo. Shown below are the propertise for the tracking state of our examples KryptonButton instance. You can see the new properties being used to remap black into red.

To complete the example I also setup the pressed state to remap black to blue. You can see the result of the changes below where the three different states normal, tracking and pressed are shown in that order.

Ok, so this is not a very exciting image but it does show how you can provide a single image and then alter the displayed color. With this new ability you have a full range of options for achieving the button appearance you need. Already you can alter the border and background per state and now you can alter the image color per state.

Leave a Reply