I am trying to add two methods to the Controls class in C#, these classes being 'UpColor' and 'DownColor' so that I can set a buttons BackColor depending on whether the state of the button is 'up' or 'down'
I have tried using extension methods, however because extension methods are static is means that every time I select a different button it will use the previous buttons up/down color, instead of it's own.
Is there a way of adding to the Controls class so that I can get/set a Color?
I have decided to go down the route of adding a static class and to have a dictionary for each method. It's not what I wanted, but I should do the job..
static class ButtonColors
{
public static Dictionary<Control, Color> UpColor
{
get;
set;
}
public static Dictionary<Control, Color> DownColor
{
get;
set;
}
}