I have the following code:
foreach (Color color in new ColorConverter().GetStandardValues())
{
output.Wri开发者_开发百科te(color.ToString());
}
What would be the syntax to get it to show as a color palette instead of just listing the colors?
I think you're looking for something like this:
StringBuiler sb = new StringBuiler();
foreach (Color color in new ColorConverter().GetStandardValues())
{
sb.Append(string.format("<div style=\"float:left;width:5px;height:5px;background-color:#{0}\"></div>". color.ColorCode));
}
ltrlColorPalette.Text = sb.ToString();
精彩评论