473,320 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Getting MouseWheel Event in UserControl

Hi to all that read,

I have created a usercontrol for which i want to be able to use the mouse
wheel. Currently I have to make the form that the control is used in pass
the mousewheel event to the control by code. Is there any way to
automatically get the event for when the mouse is over the control area.

Cheers and thank in addvance for any help provided

Adrian
Nov 21 '05 #1
2 5181
Hi Adrian,

OnMouseEnter and OnMouseLeave should do the trick.

Cheers,
Alex Clark
"Adrian Game" <ad*********@warwick.ac.uk> wrote in message
news:42***********************@ptn-nntp-reader02.plus.net...
Hi to all that read,

I have created a usercontrol for which i want to be able to use the mouse
wheel. Currently I have to make the form that the control is used in pass
the mousewheel event to the control by code. Is there any way to
automatically get the event for when the mouse is over the control area.

Cheers and thank in addvance for any help provided

Adrian

Nov 21 '05 #2
Put this finction in your Usercontrol:

Protected Overrides Sub OnMouseWheel(ByVal e As _
System.Windows.Forms.MouseEventArgs)
....
End Sub

Note that this event won't be raised unless your "usercontrol" has the focus
when the mouse wheel is used. However, you can set the focus to your user
control in the "OnMouseHover" event:

Protected Overrides Sub OnMouseHover(ByVal e As System.EventArgs)
Me.Focus()
End Sub

"Adrian Game" wrote:
Hi to all that read,

I have created a usercontrol for which i want to be able to use the mouse
wheel. Currently I have to make the form that the control is used in pass
the mousewheel event to the control by code. Is there any way to
automatically get the event for when the mouse is over the control area.

Cheers and thank in addvance for any help provided

Adrian

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Niranjan | last post by:
I have a data entry form. I am trying to avoid users accidentally using the mouse wheel and saving an incomplete record (or saving record that skips the validation routine). In Mousewheel event,...
0
by: Dennis | last post by:
I have a usercontrol I'm working on and it has several rows of data. I would like to scroll the data when the Mouse moves onto the control and the scroll wheel is turned without setting the focus...
0
by: Jordi Rico | last post by:
Hi, I'm creating an UserControl, a kind of a datagrid. By now, i've been able to implement mousewheel events, so I can move the scrollbars when the app detects this event. Now i want to add some...
1
by: Nicholas Shewmaker | last post by:
(I apologize if this posts twice. My AVG is being fussy.) From what I've read, MouseWheel is a very tricky event. I have replaced my Python tcl84.dll and tk84.dll files with those in the...
4
by: tlemcenvisit | last post by:
Hi, I program a windows form application with VC++.NET, I wish to program an event which occurs when the user uses the mouse wheel in a pictureBox control. Which event should I use? And how can...
7
by: James | last post by:
Hi, I have a Windows Forms application which uses multiple child forms (MDI interface). The height of one of the child forms is larger than the height of the MDI client area, so when this...
3
by: Dave K | last post by:
I seem to be missing something... I want to use a mousewheel event in my VB.NET app... and there's a lot of example code on the net showing how to use the mousewheel event... and the .NET docs...
0
by: WaterWalk | last post by:
Hello. When I tried to make Tkinter canvas widget respond to MouseWheel event on Windows XP, I failed. The canvas just doesn't receive MouseWheel event. I used bind_all to find out which widget...
1
by: =?Utf-8?B?UmljaA==?= | last post by:
In a database search application (vb2005), the user wants to be able to scroll through records using the mousewheel. The data display form contains textboxes for the main data and a datagridview...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.