All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP新手总结的PHP基础知识_php资料_编程技术
GDI+绘制验证码图片
开源MVC框架PixelDragonsMVC.NET发布_.net资料_编程技术
动态网页制作学习:PHP预定义变量_php资料_编程技术
下一主题的实现_[PHP教程]
ADO.NET的一些使用经验_[Asp.Net教程]
PHP网站开发中关于包含路径问题的解决方案_[PHP教程]
三层Web体系结构里的两种数据绑定模式_.net资料_编程技术
JS实现图片无缝滚动的完美解决_JavaScript技术_编程技术
SQL Server 索引基础知识(1)--- 记录数据的基本格式_[SQL Server教程]
Reading number is top 10 pictures
The dog buy the ham oneself
Azusa Yamamoto1
yy365网站上的美女1
王艳写真温柔如水1
29 the belle stars after bath figure5
So beauty, will let you spray blood2
住院一星期,检测费两万
The real super beauty3
BingBingFan apple dew point photo gallery1
Summer is most suitable for young people to travel in China9
Download software ranking
虚拟机5.5.3版
在线棋牌游戏3.05版
Unix video tutorial18
Sora aoi - one of more PK
Boxer's Top ten classic battle5
卡丁车单机版
Tram sex maniac 2 (H) rar bag12
美女写真2
Eclipse-CALMSANNY (second edition)
变速齿轮3.26
aaa published in(发表于) 2013/12/18 7:57:28 Edit(编辑)
C#,DataGridView隔行显示不同的颜色_.net资料_编程技术

C#,DataGridView隔行显示不同的颜色_.net资料_编程技术

C# DataGridView隔行显示不同的颜色_.net资料_编程技术-你的首页-uuhomepage.com

  本文将向大家介绍在C#中如何通过编程实现让DataGridView控件隔行显示不同的颜色……


  如果该dataGridView是跟数据库绑定的,则可以触发DataBindingComplete事件:


private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
  {
  if (this.dataGridView1.Rows.Count != 0)
  {
  for (int i = 0; i < this.dataGridView1.Rows.Count; )
  {
  this.dataGridView1.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.Pink;
  i += 2;
  }
  }
  }


  如果没有绑定数据库,那么当dataGridView中的数据有所改变或显示的时候可以添加以下的代码:


if (this.dataGridView1.Rows.Count != 0)
  {
  for (int i = 0; i < this.dataGridView1.Rows.Count; )
  {
  this.dataGridView1.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.Pink;
  i += 2;
  }
  }





添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.