类型"string"的值无法转换为"System.Drawing.Color"
2011-09-26 18:11
525 查看
代码如下:
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 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"
- 转:类型"string"的值无法转换为"System.Drawing.Color"
- 无法将类型string隐式转换为System.Drawing.Color的解决方法
- 无法将类型string隐式转换为System.Drawing.Color的解决方法
- VS ---- 无法将类型"System.Data.EntityState"隐式转换为"System.Data.Entity.EntityState"
- 【Debug】无法将类型“string”隐式转换为"double"
- MVC ---- 无法将类型"System.Data.EntityState"隐式转换为"System.Data.Entity.EntityState"
- 报错:无法将类型"System.Data.EntityState"隐式转换为"System.Data.Entity.EntityState"
- .Net EF 无法将类型"System.Data.EntityState"隐式转换为"System.Data.Entity.EntityState"
- 报错:无法将类型"System.Data.EntityState"隐式转换为"System.Data.Entity.EntityState"
- 无法将类型"int"隐式转换为"string"
- 无法将类型 System.Drawing.Color 隐式转换为 System.Drawing.Brush
- 无法将类型“System.Collections.Generic.List<anonymous type:string ClassID,string ClsssName>”隐式转换为“System.Collections.Generic.List<Ecology.Model.EnergyFlowGraph>”
- 无法将类型为“Oracle.DataAccess.Types.OracleString”的对象强制转换为类型“System.String”。
- 关于MVC中无法将类型为“System.Int32”的对象强制转换为类型“System.String”的问题。
- 无法将类型为“System.DBNull”的对象强制转换为类型“System.String”
- 个推推送时,Log4net 无法将类型"System.RuntimeType"的对象强制转换为类型"log4net
- “无法将类型"string"转换为"char"”?
- “LINQ to Entities 不识别方法"System.String ToString()",因此该方法无法转换为存储表达式。”
- Linq中字段数据类型转换问题(Linq to entity,LINQ to Entities 不识别方法"System.String ToString()"问题解决)