using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} public virtual void button1_Click(object sender, EventArgs e) //祖先窗口的事件
{
MessageBox.Show("祖先的事件!。");
}
}
}//继承自Form1窗口namespace WindowsApplication1
{
public partial class Form2 : WindowsApplication1.Form1
{
public Form2()
{
InitializeComponent();
} public override void button1_Click(object sender, EventArgs e)//重写了原来的事件
{
MessageBox.Show("继承后的事件!");//这个事件为什么会触发两次????
}
}
}继承事件对象
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} public virtual void button1_Click(object sender, EventArgs e) //祖先窗口的事件
{
MessageBox.Show("祖先的事件!。");
}
}
}//继承自Form1窗口namespace WindowsApplication1
{
public partial class Form2 : WindowsApplication1.Form1
{
public Form2()
{
InitializeComponent();
} public override void button1_Click(object sender, EventArgs e)//重写了原来的事件
{
MessageBox.Show("继承后的事件!");//这个事件为什么会触发两次????
}
}
}继承事件对象
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货