【发布时间】:2012-11-26 19:01:39
【问题描述】:
我查看了 this thread 关于完全相同的问题,但该解决方案对我不起作用。
基本上,当用户与 Windows 窗体上的图表控件交互时,我想要完成的是鼠标滚轮事件。
现在我尝试了一些不同的方法。
public mainForm()
{
InitializeComponent();
this.chData.MouseWheel +=new MouseEventHandler(chData_MouseWheel);
}
我也尝试将其添加到 mainForm.Designer.cs:
this.chData.TabIndex = 2;
this.chData.Text = "chart2";
this.chData.MouseWheel +=
new System.Windows.Forms.MouseEventHandler(this.chData_MouseWheel);
this.chData.MouseClick +=
new System.Windows.Forms.MouseEventHandler(this.chData_MouseClick);
this.chData.MouseDoubleClick +=
new System.Windows.Forms.MouseEventHandler(this.chData_MouseDoubleClick);
this.chData.MouseMove +=
new System.Windows.Forms.MouseEventHandler(this.chData_MouseMove);
(我在这里包含了整个块以进行演示)。我也有如下定义的函数:
private void chData_MouseWheel(object sender, MouseEventArgs e)
{
MessageBox.Show("FJDKS");
}
不幸的是我不能让这该死的东西开火?谁能告诉我哪里出错了?提前致谢!
【问题讨论】:
-
chData 是什么控件?这个图表控件来自哪里?
-
chData 是我的图表控件的名称。我在设计中添加了它(即不在代码中)。
标签: c# winforms events charts mousewheel