0
votes

I have a textbox and when I scroll down my form with the mouse wheel and hit the textbox with the mouse, it stops scrolling.

Is there a way to avoid that ?

3
A mouse pointer does not commonly change a text editor, surely you can phrase that better? Using a Label instead of TextBox would be the most obvious way to avoid confusing the dickens out of your user..Hans Passant

3 Answers

0
votes

If you just want the visual part, change the property "Cursor" of the textbox to "Arrow"

enter image description here

0
votes

If you don't want a TextBox to be focused, you have a few solutions

  1. Set the ReadOnly property to True

Nobody will be able to enter text in your TextBox, exept if you do it programatically. However, it will still be possible to click on it and if clicked you will see the blinking cursor (don't know the name in English). When the mover hovers it it will turn into a cursor.

This means this option allows the focus on the control, but it will not be possible to enter data.

  1. Set the Enabled property to False

Again, it will not be possible to enter any data. Also, it will not be possible to click on it and the cursor will not change if you hover it.

This means this option disallows the focus on the control.

  1. Put a Label instead

If nobody will ever be able to insert data in your TextBox, maybe it is better to put a Label there. If you choose option 1 or 2, it is because at some point you might allow user to change the text inside. But if it will only be modified by the program, Label is good enough.

Focus is never allowed on Labels.

0
votes

OK, If I understand you correctly, what you are searching is to keep mouse wheeling while passing on your TextBox. Is that correct ?

There is, I think, a way to achieve that. This code however has not been tested, so keep me informed if it worked.

Public Sub New()
    InitializeComponents()
    'Other inits here
    AddHandler TextBox1.MouseWheel, AddressOf TBMouseWheel
End Sub

Private Sub TBMouseWheel(sender As Object, e As MouseEventArgs)
    Me.OnMouseWheel(e)
End Sub

This way, when your textbox captures a MouseWheel event, it is passed on the form, which will handle it (I think). Sorry I don't have the opportunity to test it right now, but I believe this should do the trick.