首先看看效果一:
效果二:
實現上面效果,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);
});