【发布时间】:2014-11-12 08:46:14
【问题描述】:
我正在尝试更改 c# 数据表中的文本颜色。现在我需要知道如何更改该表中特定单元格的前景(文本)颜色。
DataTable table = new DataTable();
//some code here
//lets say the cell is [0,0]
//change the foregroud color like this
table.columns[0].rows[0].forgroundColor ="red";
【问题讨论】:
-
什么是
DataTable?是System.Data.DataTable吗? -
你在为DataTable应用颜色做什么?
-
标记了这个问题。这需要更多的关注.. 太晚了,我看到这是 6 岁。无论如何,要回答这个问题,我们需要更准确的平台(asp.net 或 MVC ?)并且不清楚在哪里需要更改颜色。数据库表没有颜色,除非您为其指定一个字段。上面的代码在数据库中工作,在字段“forgroundcolor”上设置一个字符串“red”。