如何以编程方式更改数据变量的颜色以供显示 [英] how to programatically change the color of the data variable for display

查看:53
本文介绍了如何以编程方式更改数据变量的颜色以供显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以diff颜色显示变量'v_propertytype_name_selected',比如绿色。

我的代码:



Label1.Text = 抱歉!截至目前没有找到+ v_propertytype_name_selected +的详细信息;

Label1.visible = true;





谢谢。

I want to display the variable 'v_propertytype_name_selected 'in diff color,say green.
My code:

Label1.Text = "Sorry ! no details found as of now for " +v_propertytype_name_selected + "";
Label1.visible=true;


Thanks.

推荐答案

使用System.Drawing;



Label1.Backcolor = color .Green
using System.Drawing;

Label1.Backcolor=color.Green






插入包含颜色属性的Span标签



ex:



Hi,

Insert Span tag which contains color attribute

ex:

string spanGreenStart = "<span style="color:green">";
string spanEnd = "</span>";
Label1.Text = "Sorry ! no details found as of now for " 
+spanGreenStart +
+v_propertytype_name_selected + spanEnd;





希望它有所帮助,



--SJ



Hope it helps,

--SJ


您可以使用Color.FromName()方法。



见下面的链接。



Color.FromName方法
You can use Color.FromName() method.

See below link.

Color.FromName Method


这篇关于如何以编程方式更改数据变量的颜色以供显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆