Zayko in the Net

Personal blog of Vitaly Zayko


Inverting colors (C#)

Sometimes, when you change, for example, background color of an object dynamically, you should dynamically change foreground color as well to keep a text readable. Here is very simple way to do it:

public Color InvertColor(Color color){
    return Color.FromArgb(color.ToArgb() ^ 0xFFFFFF);

First Blog Post

Hi and welcome to Vitaly Zayko Blog!

My name is Vitaly Zayko and I'm Software Developer forlast 15 years. I created this blog to post some useful code snippets that hardto remember especially when use them time to time. These snippets will be mostlyrelated to Microsoft technologies such as C#, WPF, Silverlight, ASP.NET and SQL.

I going to start posting very soon. So please come back!


Vitaly Zayko