下载此示例:
http://www.cnblogs.com/WizardWu/archive/2008/09/28/1301616.html
用 Property (getter, setter) :
Code
using System.Drawing;
public class WizardGridView : System.Web.UI.WebControls.GridView
{
private System.Drawing.Color FOddRowBackColor = System.Drawing.Color.Empty;
// 光棒 - 单数行的背景颜色
/// <summary>
/// 单数行的背景颜色。
/// </summary>
[System.ComponentModel.DefaultValue(""),
System.ComponentModel.Category("Wizard - Appearance"),
System.ComponentModel.Description("The background color of odd row.")]
public System.Drawing.Color OddRowBackColor
{
get
{
return FOddRowBackColor;
}
set
{
FOddRowBackColor = value;
}
}
直接
public 属性类型 属性名
{
get {return 内部控件的属性;}
set{内部控件的属性=value}
}