基类窗体:protected virtual void SayHello_Click(object sender, System.EventArgs e)
{
MessageBox.Show ("Hello");
}继承窗体protected override void SayHello_Click(object sender, System.EventArgs e)
{
MessageBox.Show ("OK");
}当点击SayHello按钮时,出现了两次“OK”提示
{
MessageBox.Show ("Hello");
}继承窗体protected override void SayHello_Click(object sender, System.EventArgs e)
{
MessageBox.Show ("OK");
}当点击SayHello按钮时,出现了两次“OK”提示
解决方案 »
- 想做一个简单的播放器,
- 按照msdn上的做法做了一下offce插件和wpf结合的例子,但是运行出来好像不对,帮忙看看,谢谢
- dictionary怎么添加数据就会当key重复时候value覆盖
- 关于OLEDBDATAREADER或SQLDATAREADER的问题
- WinForm程序如何实现自动更新?
- 无法在 DLL“LEDSender.dll”中找到名为“GetValue”的入口点。
- 类库
- 怎么搞的?
- 关于sql 语句问题!
- 不可访问,因为它受保护级限制
- 用C#写的WebForm程序能否编译,我的目的是不让别人看不到源代码,还有其他方法吗 ?
- 有关NavigateUrl的一个问题?请高手回答,在线等待!!
把基类中的
this.SayHello.Click += new System.EventHandler(this.SayHello_Click);
注释掉就可以了。谢谢 qimini(循序渐进)
this.SayHello.Click += new System.EventHandler(this.SayHello_Click);
注释掉就可以了。????那你在哪订阅的
this.SayHello.Click += new System.EventHandler(this.SayHello_Click);
注释掉就可以了。????那你在哪订阅的
强烈支持 xingd(xingd)
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(96, 104);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button1});
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false); }
#endregion protected virtual void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("Show Me");
}
} public class MyForm:Form1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new MyForm());
} protected override void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("Show Me");
}
}