我在练习写用户控件,我写的这个很简单,就是用个Lable显示当前的日期而已,我在里面设置了一个颜色属性,但是我在SetColor()里面怎么写不了get和set呢?
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
public partial class ShowDate : System.Web.UI.UserControl
{
private Color _color = Color.Black;
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Today.ToString();
}
public Color SetColor()
{
}
}
------解决方案--------------------------------------------------------
SetColor()===> SetColor 去掉()带()就成了方法