i ran into a problem with my c# application, i have a class(settings) in which i store the design settings for my application: settings class:
public class settings
{
public string menuBackground, textColor, overallBackground, backgroundImage;
}
i have stored the settings inside an XML file:
<settings>
<menuBackground>Black</menuBackground>
<textColor>SteelBlue</textColor>
<overallBackground>White</overallBackground>
<backgroundImage>none</backgroundImage>
</settings>
but now the problem is that i need to change the colors of the form items in my application.
i managed to make the object form the xml file so thats not the problem, i have tried this:
var path = @"c:\test\test.xml";
using (FileStream fs = new FileStream(path, FileMode.Open))
{
XmlSerializer xSer = new XmlSerializer(typeof(settings));
settings setting = (settings) xSer.Deserialize(fs);
menuStrip1.BackColor = Color.setting.background;
menuStrip1.ForeColor = setting.foreground;
}
but visual studio tell sme that the Color expects an identifier, so now my question is: how can i get the color inside my setting.background after the Color, so in this case for example it would be: Color.black;
No comments:
Post a Comment