需要改变颜色 [英] Need to change color

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

问题描述

这里我正在显示一个错误消息,如politisians不应该懒惰,如下所示。所以我得到错误消息的默认前颜色(黑色)。我需要红色......



默认= politisians不应该懒惰



需要= politisians应该不要偷懒



Here i am doing display one error Message like "politisians should not be lazy" like below. so i am getting default fore color (black)of error Message . i need red color...

default = politisians should not be lazy

need = politisians should not be lazy

try
{
         IndiaAssemblies.ForEach(delegate(Indiaassembly e)
         {
                  if (string.IsNullOrEmpty(e.politisians))
                  {
                          throw new     System.DataMisalignedException("politisians should not be lazy");
                  }
         });
 }
catch (Exception ex)
{
         return RedirectToAction("Indiaparlement", "INDIA", new { somex = objindia.somex.ToString(),
            Revision = objindia.Revision.ToString(), errormsg = ex.Message });
}



谢谢

Hareesh


Thanks
Hareesh

推荐答案

字符串本身没有颜色 - 当您通过某种形式的控件将其呈现给用户时,它只会获得颜色。与字符串一样,它只是一个字符集合,没有显示属性,如大小,颜色,字体等。



所有各种控件都会自行决定哪些属性控制颜色,何时应该应用它们。例如,将DataGridView中的单个单元格更改为红色文本是在标签中更改它的另一个过程。在网站上进行操作与在控制台应用程序中进行操作不同!



看看你如何向用户呈现文本,看看如何控件使用颜色 - 我们不能告诉你这样做,所有系统和控件都是红色的。
A string in itself has no colour - it only gets a colour when you present it to the user, via a control of some form. As as string, it is only a collection of characters and has no "display" attributes such as size, color, font and so on.

And all of the various controls will decide for themselves what properties control colour, and when it should be applied. Changing a single cell in a DataGridView to red text is a different process to changing it in a label, for example. And doing it in a website will be different to doing it in a console application!

Look at how you are presenting the text to the user, and look at how that control uses colour - we can't tell you "Do this" and it'll be in Red for all systems and controls.


这篇关于需要改变颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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