huweixiong的专栏
登录
注册
全站
当前博客
空间
博客
好友
相册
留言
用户操作
[即时聊天]
[发私信]
[加为好友]
huweixiong
ID:huweixiong
共
499
次访问,排名
2万外
好友
0
人,关注者
0
人
huweixiong的文章
原创 4 篇
翻译 0 篇
转载 0 篇
评论 0 篇
最近评论
文章分类
收藏
相册
兄弟
存档
2008年03月(1)
2007年12月(3)
软件项目交易
订阅我的博客
交替颜色的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简单使用
|
评论:没有评论。
发表评论
姓 名:
主 页:
校验码:
看不清,换一张
当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击
登录