会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
玄新-术业有专攻
datagrid 上面的行的光亮条跟随鼠标移动
if
((e.Item.ItemType
==
ListItemType.Item)
||
(e.Item.ItemType
==
ListItemType.AlternatingItem))
{
e.Item.Attributes.Add(
"
onmouseover
"
,
"
this.style.backgroundColor='#ffffcc';this.style.color='buttontext';this.style.cursor='default';
"
);
//
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=this.getAttribute('BKC');");
e.Item.Attributes.Add(
"
onmouseout
"
,
"
this.style.backgroundColor='';this.style.color='';
"
);
}
可以实现光亮条的选择
设置指定行的颜色
if
((e.Item.ItemType
==
ListItemType.Item)
||
(e.Item.ItemType
==
ListItemType.AlternatingItem))
{
if
(e.Item.ItemIndex
==
(i_currentline
-
1
))
{
e.Item.BackColor
=
System.Drawing.Color.Yellow;
}
}
行颜色交替显示:
在DataGrid 里面的ItemDataBound事件
//
颜色交替显示
if
(e.Item.ItemIndex
>=
0
&&
e.Item.DataItem
is
DataRowView)
{
DataRowView row
=
(DataRowView)e.Item.DataItem;
int
numj
=
e.Item.Cells.Count;
for
(
int
j
=
0
; j
<
numj; j
++
)
{
e.Item.Cells[j].ForeColor
=
System.Drawing.Color.Black;
e.Item.Cells[j].BackColor
=
System.Drawing.Color.SkyBlue;
}
}
posted on
2006-12-19 11:36
玄新
阅读(
164
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
导航
博客园
首页
联系
管理