代码如下:
string strC="#C0FFFF";
Label1.BackColor=strC;
报错为:类型"string"的值无法转换为"System.Drawing.Color"
解决方法一:
string strC="#C0FFFF";
Label1.BackColor=System.Drawing.ColorTranslator.FromHtml(strC)
解决方法二:
string strC= "#C0FFFF";
Label1.BackColor=System.Drawing.Color.FromName("#C0FFFF");
类型"string"的值无法转换为"System.Drawing.Color"
原创
©著作权归作者所有:来自51CTO博客作者Misy的原创作品,请联系作者获取转载授权,否则将追究法律责任

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章