我想在运行时更改文本的颜色 [英] i want to change the colour of text at runtime

查看:111
本文介绍了我想在运行时更改文本的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在运行时更改文本的颜色...

I want to change the colour of text at runtime ...

DataRow dr = dt.NewRow();
            dr[0] = "1";
            dr[1] = "SAM";
            dr[2] = "Male";
         
            dr[3] = "Offline";
            dr[4] = "Comp123";
            dr[5] = new BitmapImage(new Uri("/Chat;component/Images/offline.png", UriKind.RelativeOrAbsolute));
            dt.Rows.Add(dr);


在这段代码中,我想将离线文本的颜色更改为绿色...
如何在C#中执行此操作...任何人都可以帮助我..


in this code i want to change the offline text colour to green...
how to do it in C#...can any one help me..

推荐答案

您不能-DataTable或DataRow没有颜色-仅可显示元素具有颜色.这取决于您在显示时设置适当的颜色,例如在网格,文本框或标签中.抱歉!
You can''t - a DataTable or a DataRow does not have a colour - only displayable elements have a color. It is going to be up to you do set the appropriate color when you display it, for example in a grid, or a textbox, or a label. Sorry!


字符串是数据类型;它没有颜色. :-)

—SA
String is a data type; it does not have color. :-)

—SA


这篇关于我想在运行时更改文本的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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