加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

C#dataGridView字体显示设置

(2012-12-02 15:02:45)
标签:

cdatagridview

字体显示设置

it

分类: C#编程知识点

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;

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有