我在visual studio中有一个颜色对话框,我目前正在使用这个c#代码显示颜色对话框并将颜色设置为面板:
private void ColorButton_Click(object sender, EventArgs e)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
ColorPanel.BackColor = colorDialog1.Color;
}
}
如何将标签设置为颜色选择器的十六进制颜色代码?
答案 0 :(得分:11)
你可以试试这个
var propCount = 0;
$.each(data.thumbnails, function(index, thumbnails) {
propCount++;
if(propCount == 1) {
$('#ThumbnailHolder').append('<img src="http://images.sportsdirect.com/images/products/' + thumbnails + '" class="LittleThumbs" BigImageLink="http://images.sportsdirect.com/images/products/' + thumbnails + '">');
} else {
$('#ThumbnailHolder').append('<a rel="example_group" title="<?PHP echo $name;?>" class="FancyBox FancyThumbs" href="http://images.sportsdirect.com/images/products/' + thumbnails + '"><img src="http://images.sportsdirect.com/images/products/' + thumbnails + '" class="LittleThumbs" BigImageLink="http://images.sportsdirect.com/images/products/' + thumbnails + '"></a>');
}
});
(Alpha,红色,绿色,蓝色)表示ARGB
& 0x00FFFFFF
)实施
"X6"
修改:如果您想从 String code = (colorDialog1.Color.ToArgb() & 0x00FFFFFF).ToString("X6");
获取Color
返回,请尝试code
:
FromArgb