It was a while ago to play the colours in .NETCF. The case was drawing darker or lighter colour when user clicks my custom design buttons. Well, I believe it would be much easier to change the colour by its original colour. So I came up with two methods to extend the existing System.Drawing.Color object. These two methods can be found similar over the Internet. So, I have to thank all the developers in the Internet...



public static Color GetColorDarker(this Color color, double factor)
{
    // The factor value value cannot be greater than 1 or smaller than 0.
    // Otherwise return the original colour
    if (factor < 0 || factor > 1)
        return color;

    int r = (int)(factor * color.R);
    int g = (int)(factor * color.G);
    int b = (int)(factor * color.B);
    return Color.FromArgb(r, g, b);
}


public static Color GetColorLighter(this Color color, double factor)
{
    // The factor value value cannot be greater than 1 or smaller than 0.
    // Otherwise return the original colour
    if (factor < 0 || factor > 1)
        return color;

    int r = (int)(factor * color.R + (1 - factor) * 255);
    int g = (int)(factor * color.G + (1 - factor) * 255);
    int b = (int)(factor * color.B + (1 - factor) * 255);
    return Color.FromArgb(r, g, b);
}