开发者

Making a menu (color palette) from looping through colors

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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜