我对WinForms事件并不熟悉,当我启动控件时,我会得到一个奇怪的error.Well:
this.MouseUp += MouseUpMethod;但问题是,当我释放鼠标按钮超出我的控制,程序识别,因为我释放鼠标在控件之上。我无法理解这个错误。有人犯过这个错误吗?
发布于 2013-12-19 20:40:14
看,您需要在InitializeComponent()之后将事件与事件处理程序关联起来。
public Form1()
{
InitializeComponent();
this.button2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.button2_MouseUp);
}那么您的事件处理程序应该是
private void button2_MouseUp(object sender, MouseEventArgs e)
{
//Do stuff here
}https://stackoverflow.com/questions/20691160
复制相似问题