MouseWheel?
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
6 posts
Page 1 of 1
Hi Guys and Gals
Does anyone know how I can use the MouseWheel on my Mouse to Move an Item (say a Panel ) around my Form, ie, Left to Right?
I have looked at the Controls in VB and can't see anything that relates to the Mouse Wheel, But maybe it is just code that's needed and not a Control..
Any Help would be great and will get you a + Rep
Thanks in Advance
Hungry
Does anyone know how I can use the MouseWheel on my Mouse to Move an Item (say a Panel ) around my Form, ie, Left to Right?
I have looked at the Controls in VB and can't see anything that relates to the Mouse Wheel, But maybe it is just code that's needed and not a Control..
Any Help would be great and will get you a + Rep
Thanks in Advance
Hungry
Well i don't know about VB but in C# i use this code in the OnMouseWheel event of the panel, button, item, label etc...
Code: Select all
if (e.Delta > 0)
{
//-- Mouse Wheel Moving UP
}
else if (e.Delta < 0)
{
//-- Mouse Wheel Moving DOWN
}
You can find me on Facebook or on Skype mihai_92b
Hey XTechVB
Ok thanks for that, I might see if i can do something similar to that for Vb
Cheers
Chris
Ps, I will let you know how i get on
Hey
Well i went online to convert it to VB
But I am still no Wiser

Chris
Ok thanks for that, I might see if i can do something similar to that for Vb
Cheers
Chris
Ps, I will let you know how i get on

Hey
Well i went online to convert it to VB
But I am still no Wiser
Code: Select all
So If anyone can Help me out I would really appreciate it, and I will give 50 Credits to anyone who can give me a working Example of a Form with a Panel being moved within it by the Middle Mouse Button '-- Mouse Wheel Moving UP
If e.Delta > 0 Then
'-- Mouse Wheel Moving DOWN
ElseIf e.Delta < 0 Then
End If

Chris
the conversion seemed wrong so try this
Code: Select all
If e.Delta > 0 Then
// Mouse Wheel Moving UP
ElseIf e.Delta < 0 Then
// Mouse Wheel Moving DOWN
End If
Moving a panel inside a form you could use this, just add it to your form code (assuming the panel is called Panel1):
Code: Select all
Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
If e.Delta > 0 Then
Panel1.Left += 1
Else
Panel1.Left -= 1
End If
End Sub
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Hey Cody
Cheers Fella, You are a Star
I have been trying to Fathom this out all afternoon and just a little bit of code like that did the trick, wwoooooooooooooohhhhhhhooooooooooooooo
Cheers Fella, You are a Star

I have been trying to Fathom this out all afternoon and just a little bit of code like that did the trick, wwoooooooooooooohhhhhhhooooooooooooooo
6 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023