Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am wondering if anyone has encountered this issue and can shed some light on it.

VS1015, .net 4.0, .net 4.5 and .net 4.6

I have a panel with a number of controls that are all programmatically added. The controls consist of labels, picture boxes, buttons and rich textboxes. The number of the controls added can vary.

When I mouse over any of the controls on the panel I can scroll the panel with the mouse wheel, all except for mouse-over the rich textboxes. The events fire when the mouse enters and leaves the rich textboxes but the mouse wheel has no effect.

This code and the scrolling function did and still does work perfectly under Windows 7 however, on machines that have been upgraded to W10, it does not.


Add RtxtBox example
VB.NET
Dim AddTxtBoxEpDesc As RichTextBox
            AddTxtBoxEpDesc = New RichTextBox
            With AddTxtBoxEpDesc
                .Name = txtE
                .Size = New Drawing.Size(445, Args.hgtTxtOverview)
                .Location = New Point(212, thisEpisodeStartPos + Args.posPic - Math.Abs(myPanel.AutoScrollPosition.Y))
                .Multiline = True
                .WordWrap = True
                .BackColor = Color.MintCream
                .BorderStyle = BorderStyle.None
                .Font = New Font("arial", 8, FontStyle.Regular)
                .Text = Args.Overview + Environment.NewLine + Environment.NewLine
                .ScrollBars = RichTextBoxScrollBars.None
                .Visible = True
            End With
            
            AddHandler AddTxtBoxEpDesc.MouseEnter, AddressOf myPanel1_MouseEnter
            AddHandler AddTxtBoxEpDesc.MouseLeave, AddressOf myPanel1_MouseLeave
            myPanel.Controls.Add(AddTxtBoxEpDesc)


The events.
VB.NET
Private Sub myPanel1_MouseEnter(ByVal sender As System.Object, ByVal e As EventArgs)
        Dim myControl0 As Control = Me.Controls.Item("myPanel1")
        myControl0.Focus()
    End Sub


VB.NET
Private Sub myPanel1_MouseLeave(sender As Object, e As EventArgs)
        Me.ActiveControl = Nothing
    End Sub


Any ideas??

What I have tried:

I have tried and still using the code above.
Posted
Updated 22-Mar-16 2:55am

1 solution

VB.NET
Hi, i had the same problem:
 
Private Sub RichTextBox_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RTB0m.MouseWheel, _
      RTB1m.MouseWheel, RTB2m.MouseWheel, RTB3m.MouseWheel, RTB4m.MouseWheel, RTB5m.MouseWheel, RTB6m.MouseWheel, _
     ....
      Dim rtbox As System.Windows.Forms.RichTextBox = sender
      rtbox.Parent.Focus()
 End Sub
That worked fine with vin 7 pro, but with win 10 it does not...
 
I'v fixed /eluded/ it as follows:

.........
Dim pas As Integer = Math.Round(Me.VerticalScroll.Maximum / 30)
             If e.Delta > 0 Then
           If Me.VerticalScroll.Value < pas Then
               Me.VerticalScroll.Value = 0
               Me.VerticalScroll.Value = 0
           Else
               Me.VerticalScroll.Value -= pas
               Me.VerticalScroll.Value -= pas
           End If
       Else
           If Me.VerticalScroll.Value + pas > Me.VerticalScroll.Maximum Then
               Me.VerticalScroll.Value = Me.VerticalScroll.Maximum
               Me.VerticalScroll.Value = Me.VerticalScroll.Maximum
           Else
               Me.VerticalScroll.Value += pas
               Me.VerticalScroll.Value += pas
           End If
       End If
    End Sub
I hope that help you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900