首先看看效果一:
效果二:
实现上面效果,Insus.NET 是使用下面例子进行修改:
http://www.cnblogs.com/insus/archive/2012/10/29/2744721.html
效果一变动代码如下:

//
for each List<T>
Pager objPg = new Pager();
objPg.PagerCollections().ForEach( delegate(Pager p)
{
TableRow tbr = new TableRow();
tbr.ID = " tr " + p.ID.ToString();
// 设置背景颜色
tbr.BackColor = System.Drawing.Color.Green;
// 宣告一个变量,当mouse over or out样式
string style = " this.style.backgroundColor='@BackColor' ";
// 宣告一个变量,将存储行原来颜色。
string bgColor = string.Empty;
TableCell tc0 = new TableCell();
tc0.Text = p.ID.ToString();
tc0.BorderWidth = Unit.Pixel( 1);
tbr.Cells.Add(tc0);
TableCell tc1 = new TableCell();
tc1.Text = p.Size;
tc1.BorderWidth = Unit.Pixel( 1);
tbr.Cells.Add(tc1);
// 获取行原来颜色。
bgColor = tbr.BackColor.Name;
// 设置mouse over事件, 最后一个参数"blue"是mouse over时的颜色,你可以自行指定。
tbr.Attributes.Add( " onmouseover ", style.Replace( " @BackColor ", " blue "));
// 设置mouse out事件
tbr.Attributes.Add( " onmouseout ", style.Replace( " @BackColor ", bgColor));
oTable.Rows.Add(tbr);
});
Pager objPg = new Pager();
objPg.PagerCollections().ForEach( delegate(Pager p)
{
TableRow tbr = new TableRow();
tbr.ID = " tr " + p.ID.ToString();
// 设置背景颜色
tbr.BackColor = System.Drawing.Color.Green;
// 宣告一个变量,当mouse over or out样式
string style = " this.style.backgroundColor='@BackColor' ";
// 宣告一个变量,将存储行原来颜色。
string bgColor = string.Empty;
TableCell tc0 = new TableCell();
tc0.Text = p.ID.ToString();
tc0.BorderWidth = Unit.Pixel( 1);
tbr.Cells.Add(tc0);
TableCell tc1 = new TableCell();
tc1.Text = p.Size;
tc1.BorderWidth = Unit.Pixel( 1);
tbr.Cells.Add(tc1);
// 获取行原来颜色。
bgColor = tbr.BackColor.Name;
// 设置mouse over事件, 最后一个参数"blue"是mouse over时的颜色,你可以自行指定。
tbr.Attributes.Add( " onmouseover ", style.Replace( " @BackColor ", " blue "));
// 设置mouse out事件
tbr.Attributes.Add( " onmouseout ", style.Replace( " @BackColor ", bgColor));
oTable.Rows.Add(tbr);
});
效果二变动代码如下:

//
for each List<T>
Pager objPg = new Pager();
objPg.PagerCollections().ForEach( delegate(Pager p)
{
TableRow tbr = new TableRow();
tbr.ID = " tr " + p.ID.ToString();
// 设置背景颜色
if (p.ID % 2 == 0)
tbr.BackColor = System.Drawing.Color.Green;
else
tbr.BackColor = System.Drawing.Color.Silver;
// 宣告一个变量,当mouse over or out样式
string style = " this.style.backgroundColor='@BackColor' ";
// 宣告一个变量,将存储行原来颜色。
string bgColor = string.Empty;
TableCell tc0 = new TableCell();
tc0.Text = p.ID.ToString();
tc0.BorderWidth = Unit.Pixel( 1);
tbr.Cells.Add(tc0);
TableCell tc1 = new TableCell();
tc1.Text = p.Size;
tc1.BorderWidth = Unit.Pixel( 1);
tbr.Cells.Add(tc1);
// 获取行原来颜色。
bgColor = tbr.BackColor.Name;
// 设置mouse over事件, 最后一个参数"blue"是mouse over时的颜色,你可以自行指定。
tbr.Attributes.Add( " onmouseover ", style.Replace( " @BackColor ", " blue "));
// 设置mouse out事件
tbr.Attributes.Add( " onmouseout ", style.Replace( " @BackColor ", bgColor));
oTable.Rows.Add(tbr);
});
Pager objPg = new Pager();
objPg.PagerCollections().ForEach( delegate(Pager p)
{
TableRow tbr = new TableRow();
tbr.ID = " tr " + p.ID.ToString();
// 设置背景颜色
if (p.ID % 2 == 0)
tbr.BackColor = System.Drawing.Color.Green;
else
tbr.BackColor = System.Drawing.Color.Silver;
// 宣告一个变量,当mouse over or out样式
string style = " this.style.backgroundColor='@BackColor' ";
// 宣告一个变量,将存储行原来颜色。
string bgColor = string.Empty;
TableCell tc0 = new TableCell();
tc0.Text = p.ID.ToString();
tc0.BorderWidth = Unit.Pixel( 1);
tbr.Cells.Add(tc0);
TableCell tc1 = new TableCell();
tc1.Text = p.Size;
tc1.BorderWidth = Unit.Pixel( 1);
tbr.Cells.Add(tc1);
// 获取行原来颜色。
bgColor = tbr.BackColor.Name;
// 设置mouse over事件, 最后一个参数"blue"是mouse over时的颜色,你可以自行指定。
tbr.Attributes.Add( " onmouseover ", style.Replace( " @BackColor ", " blue "));
// 设置mouse out事件
tbr.Attributes.Add( " onmouseout ", style.Replace( " @BackColor ", bgColor));
oTable.Rows.Add(tbr);
});