在.NET c#里按照帮助里<演练:使用 Visual C# 创作用户控件>
进行操作,我做到<重写 ctlClock 的 timer1_Tick 方法 :>出现了问题.

解决方案 »

  1.   

    中括号出是有问题的地方:
    namespace ctlClockLib
    {
    public class ctlAlarmClock : [ctlClockLib.ctlClock]//已在多处定义“ctlClockLib.ctlClock”义
    {
    private System.ComponentModel.IContainer components = null;
            private DateTime dteAlarmTime;
    private System.Windows.Forms.Label lblAlarm;
    private bool blnAlarmSet;
    //重写 ctlClock 的 timer1_Tick 方法 用到的
    private bool blnColorTicker;
    //新的属性
    public DateTime AlarmTime
    {
    get
    {
    return dteAlarmTime;
    }
    set 
    {
    dteAlarmTime=value;
    }
    } public bool AlarmSet
    {
    get
    {
    return blnAlarmSet;
    }
    set
    {
    blnAlarmSet=value;
    }
    }
    public ctlAlarmClock()
    {

    // 该调用是 Windows 窗体设计器所必需的。
    InitializeComponent(); // TODO: 在 InitializeComponent 调用后添加任何初始化

    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    }

    protected override void [timer1_Tick](object System.EventArgs e)
    // 没有找到适合的方法来重写

    {
    //重写 ctlClock 的 timer1_Tick 方法
    base.timer1_Tick(sender, e);//已经出问题了,所以就没再写下去了.

    }
    }
    }
      

  2.   

    这个要写在哪呀?
    protected override void timer1_Tick(object sender,System.EventArgs e)
    {
    //重写 ctlClock 的 timer1_Tick 方法
    base.timer1_Tick(sender, e);

    }