C#dataGridView字体显示设置
2015-07-19 00:20
337 查看
1.设置dataGridView中数据的显示风格,需要设置DefaultCellStyle里面的SelectionBackColor还有Font(字体设置).
设置某行的字体颜色代码:
dataGridView1.Rows[i].DefaultCellStyle.ForeColor=Color.Red;
2.设置datagridvie中使列和行的宽度不能由用户更改,代码:
this.dataGridView1.Columns[0].Frozen = true;
this.dataGridView1.Rows[0].Frozen = true;
3.设置datagridview中某行的某个字段字体的颜色:
dataGridView1.Rows[i].Cells["字段名"].Style.ForeColor = Color.Red;
设置某行的字体颜色代码:
dataGridView1.Rows[i].DefaultCellStyle.ForeColor=Color.Red;
2.设置datagridvie中使列和行的宽度不能由用户更改,代码:
this.dataGridView1.Columns[0].Frozen = true;
this.dataGridView1.Rows[0].Frozen = true;
3.设置datagridview中某行的某个字段字体的颜色:
dataGridView1.Rows[i].Cells["字段名"].Style.ForeColor = Color.Red;
相关文章推荐
- C#中datagirdview表头变换
- C#子窗体精确定位到父窗体的某个位…
- C#将子窗体填充到父窗体的panel中
- AutoResetEvent和ManualResetEvent区别[C#]
- C#多核心变成 利用多核心优势并行计算
- C#匿名函数之匿名方法与lambda表达式
- c# winform:当子窗体关闭时,更新父窗体DataGridView控件的值
- 运用C#读取导入的Excel部分数据为空的解决方法
- C#获取当前函数名称
- C# char 和string之间转换
- C# Action和Func
- C# WinForm 关闭登陆窗体,打开主窗体的实现
- C#记录消息到日志文件的方法
- c# 调用外部exe程序
- C#版七层登陆
- 【转】C# WinForm窗体及其控件的自适应
- c# XML和实体类之间相互转换(序列化和反序列化)
- C#类的扩展
- C#异步调用的好处和方法
- C# 中的委托和事件