I've looked at this thread concerning the exact same problem but that solution didn't work for me.
Basically what I am trying to accomplish is a mouse wheel event when the user is interacting with a chart control on a windows form.
Right now I have tried a few different things.
public mainForm()
{
InitializeComponent();
this.chData.MouseWheel +=new MouseEventHandler(chData_MouseWheel);
}
Also I have tried adding this to the 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);
(I've included the whole block here for demonstration). I also have the function defined as such below:
private void chData_MouseWheel(object sender, MouseEventArgs e)
{
MessageBox.Show("FJDKS");
}
Unfortunately I can't get the darn thing to fire? Can anyone tell me where I am going wrong? Thanks in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…