Results 1 to 40 of 47

Thread: VB6-MouseWheel With Any Control

Hybrid View

  1. #1
    New Member
    Join Date
    Apr 2006
    Posts
    1

    Wink Re: VB6 - MouseWheel with Any Control (originally just MSFlexGrid Scrolling)

    Great work but...

    I do not like individually testing for min and max for each control, so I extracted those lines into a function in the module:
    Public Function MouseWheelChange(CurrentValue As Variant, DeltaValue As Variant, MinValue As Variant, MaxValue As Variant) As Variant
    Dim newvalue As Variant
    newvalue = CurrentValue + DeltaValue
    If newvalue < MinValue Then
    newvalue = MinValue
    ElseIf newvalue > MaxValue Then
    newvalue = MaxValue
    End If
    MouseWheelChange = newvalue
    End Function

    The MouseWheel() sub now looks like:
    Public Sub MouseWheel(ByVal MouseKeys As Long, ByVal Rotation As Long, ByVal Xpos As Long, ByVal Ypos As Long)
    On Error Resume Next
    If TypeOf Me.ActiveControl Is VScrollBar Then
    With VScroll1
    .Value = MouseWheelChange(.Value, Sgn(Rotation) * .LargeChange, .Min, .Max)
    End With
    ElseIf TypeOf Me.ActiveControl Is TextBox Then
    Text1.Text = MouseWheelChange(Text1.Text, Rotation, -1000, 1000)
    End If
    End Sub

    Just my 2 cents.

  2. #2
    Fanatic Member ididntdoit's Avatar
    Join Date
    Apr 2006
    Location
    :uoıʇɐɔoן
    Posts
    765

    Talking Re: VB6 - MouseWheel with Any Control (originally just MSFlexGrid Scrolling)

    Great code, bushmobile, but is there any way to add support for a tilt wheel (Microsoft IntelliMouse Explorer 5.0). Thanx!
    Visit here to learn to make the VB interface fit you!.
    "I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison
    "The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners" -- Ernst Jan Plugge

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width