I currently have some global variables like this (the global part isn't really relevant):
public Brush backgroundColor;
public Brush textColor;
public double timeOffset;
public double dateOffset;
public string title;
public bool showTitle;
public bool showText;
I declare a new List<string>
to store said variables using this:
List<string> x = new List<string>();
x.Add(backgroundColor);
x.Add(textColor);
x.Add(timeOffset.ToString());
x.Add(dateOffset.ToString());
x.Add(title);
x.Add(showTitle.ToString());
x.Add(showText.ToString());
Noticeably, I'm only temporarily storing these strings into my list. I will be using them later on as objects. If I wanted to convert my strings
from this list to types like bool
or double
, I can simply us Convert.ToDouble()
or Convert.ToBoolean()
, however, I am unable to find anything that could do so for a Brush
object.
My Brush
object is used like this: Brushes.Black
(Reference MSDN). I've looked at this thread, but the ways they input are either in RGB or Hexadecimal, which isn't what I need.
EDIT: If there is no way, or you can suggest better ways to use this, please let me know. Why I need a Brushes.XXXX
is because I am drawing images onto bitmap
objects.