Middle mouse click and scroll
-
I am experiencing difficulty trying to make a trackbar scroll when the middle mouse button/ball is clicked and scrolled. I need the mouse scroll wheel to scroll up and down when it is clicked and reset the value to the middle when realised. Does anyone know how this can be done. Thanx George
-
I am experiencing difficulty trying to make a trackbar scroll when the middle mouse button/ball is clicked and scrolled. I need the mouse scroll wheel to scroll up and down when it is clicked and reset the value to the middle when realised. Does anyone know how this can be done. Thanx George
I have tried this: private void trackBar1_Scroll_1(object sender, MouseEventArgs m) { if (m.Button == MouseButtons.Middle) { label1.Text = trackBar1.Value.ToString(); } } but dont know if it will work as havent got it to compile because its complaining about the delegate this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll_1); I dont know how to change it, it works with eventArgs but i put in mouseEventArgs which i need and it does not like it.
-
I have tried this: private void trackBar1_Scroll_1(object sender, MouseEventArgs m) { if (m.Button == MouseButtons.Middle) { label1.Text = trackBar1.Value.ToString(); } } but dont know if it will work as havent got it to compile because its complaining about the delegate this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll_1); I dont know how to change it, it works with eventArgs but i put in mouseEventArgs which i need and it does not like it.
Hi, you can't just change the partameter types; Scroll gives an EventArgs, not a MouseEventArgs. you are aware of the Control.MouseWheel event? That one offers a MouseEventArgs. :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Hi, you can't just change the partameter types; Scroll gives an EventArgs, not a MouseEventArgs. you are aware of the Control.MouseWheel event? That one offers a MouseEventArgs. :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Hi, you can't just change the partameter types; Scroll gives an EventArgs, not a MouseEventArgs. you are aware of the Control.MouseWheel event? That one offers a MouseEventArgs. :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.