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

Reading number is top 10 articles
SQL细节知识积累_[SQL,Server教程]
ASP.NET加密算法(MD5、DES)_[Asp.Net教程]
delphi事件的定义及作用
连接PHP和Java
怎样从ASP.NET,2.0中读取连接字符串的设置_[Asp.Net教程]
PHP爱好者来看:初学者头痛问题汇总_php资料_编程技术
[delphi语法7]delphi中While语句的使用实例
C#教程:使用键盘热键实例
ASP.NET&Spring.NET&NHibernate最佳实践(五)——第3章人事子系统(2)_[Asp.Net教程]
Visual,C#,2005快速入门之运用作用域_[Asp.Net教程]
Reading number is top 10 pictures
Summer is most suitable for young people to travel in China2
Fierce! China's special forces training the devil2
Perfect small Laurie1
The woman fight much more than men
分手的感悟
More attractive than sora aoi3
Plump, too plump!1
到南昌西站了3
The real super beauty3
Sora aoi on twitter5
Download software ranking
The Bermuda triangle2
Prostitutes diary
传奇私服架设教程
Tram sex maniac 2 (H) rar bag3
Unix video tutorial18
Dance with duck(male prostitution)
jdk1.6 for windows
Jinling thirteen stock
金山office2007
WebService在.NET中的实战应用教学视频 → 第1集
delv published in(发表于) 2014/1/27 6:49:09 Edit(编辑)
C#,DataGridView隔行显示不同的颜色_[Asp.Net教程]

C#,DataGridView隔行显示不同的颜色_[Asp.Net教程]

C# DataGridView隔行显示不同的颜色_[Asp.Net教程]

  本文将向大家介绍在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.