用户操作
[即时聊天] [发私信] [加为好友]
huweixiongID:huweixiong
499次访问,排名2万外好友0人,关注者0
huweixiong的文章
原创 4 篇
翻译 0 篇
转载 0 篇
评论 0 篇
最近评论
文章分类
    收藏
      相册
      兄弟
      存档
      软件项目交易
      订阅我的博客
      XML聚合  FeedSky
      订阅到鲜果
      订阅到Google
      订阅到抓虾
      订阅到BlogLines
      订阅到Yahoo
      订阅到GouGou
      订阅到飞鸽
      订阅到Rojo
      订阅到newsgator
      订阅到netvibes

      原创 交替颜色的DataGridView收藏

      新一篇: Cookies简单使用 | 

      using System;
      using System.Collections.Generic;
      using System.Text;
      using System.Windows.Forms;

      namespace Costaco.CTN.Controls
      {
          
      public class DataGridView : System.Windows.Forms.DataGridView
          
      {

              
      public DataGridView()
              
      {
              }

              
      //这里键入override,然后空格就会出来重写的列表,你选一个回车就可以了写出不同的override

              
      protected override void OnDataBindingComplete(DataGridViewBindingCompleteEventArgs e)
              
      {
                  
      if (this.Rows.Count != 0)
                  
      {
                      
      for (int i = 0; i < this.Rows.Count; i++)
                      
      {
                          
      if ((i % 2== 1)
                          
      {
                              
      this.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.WhiteSmoke;
                          }

                          
      else
                          
      {
                              
      this.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.LightBlue;
                          }

                      }

                  }
                 

                  
      base.OnDataBindingComplete(e);
              }



          }

      }


       

       通过继承原有的控件,直接实现交替颜色,也可以实现多行交替颜色。

      发表于 @ 2007年12月14日 15:50:00|评论(loading...)|编辑

      新一篇: Cookies简单使用 | 

      评论:没有评论。

      发表评论  


      当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
      Csdn Blog version 3.1a
      Copyright © huweixiong