Question How to enable scrolling with the Mouse Wheel?

kfirba

Well-known member
Joined
Dec 29, 2012
Messages
77
Programming Experience
1-3
Hello!

I have got a TableLayoutPanel and everything works greats.
There is one problem, when I'm tying to scroll up and down the Panel, nothing happens, I have to actually drag up and down the scroll bar or press the little arrows in order to scroll.

How do I activate the scrolling with the mouse wheel?

If it matters , the TableLayoutPanel is created and populated on runtime.

Thanks in advance!
 
The control must have input focus for it to receive mouse wheel scroll. Use MouseEnter event and call its Focus method (Select method will have same effect).
 
The control must have input focus for it to receive mouse wheel scroll. Use MouseEnter event and call its Focus method (Select method will have same effect).

Can you be more detailed? I have no idea what you are talking about >.<

Can you provide a code example?

Thanks!
 
I'm not sure we are talking about the same thing. Let me re-explain myself, I have a TableLayoutPanel with a certain height. When the content passes the height, scroll bars appears.

In order to scroll down and up, I have to click and drag the scroll bar, or click on the little arrows. When I try to use the mouse wheel to scroll, Nothing happens. I want to do that the user will also be able to scroll using the mouse wheel. What code do I have to use and where in order to do that?

Thanks!
 
Hi,

You are going to give JohnH a headache at this rate.

What JohnH is saying is:-

1) Select the TableLayoutPanel in the designer.
2) Select Properties and switch to the Events of the TableLayoutPanel
3) Double Click the MouseEnter event to create an event handler for the mouse entering the control
4) In the event handler add the code, YourTableLayoutPanelName.Focus

Bingo.

Ian
 
I'm not sure we are talking about the same thing. Let me re-explain myself, I have a TableLayoutPanel with a certain height. When the content passes the height, scroll bars appears.

In order to scroll down and up, I have to click and drag the scroll bar, or click on the little arrows. When I try to use the mouse wheel to scroll, Nothing happens. I want to do that the user will also be able to scroll using the mouse wheel. What code do I have to use and where in order to do that?

Thanks!
That's what you said in first post, and I understood that. I explained that for the TableLayoutPanel control to take mouse input such as wheel scroll it must have input focus, to achieve this you can call its Focus method, the time this should happen is when mouse enters the control which is when MouseEnter event happens. Does this makes any sense to you?
 
Hi,

You are going to give JohnH a headache at this rate.

What JohnH is saying is:-

1) Select the TableLayoutPanel in the designer.
2) Select Properties and switch to the Events of the TableLayoutPanel
3) Double Click the MouseEnter event to create an event handler for the mouse entering the control
4) In the event handler add the code, YourTableLayoutPanelName.Focus

Bingo.

Ian

Oh, now I see! Well, my TableLayoutPanel is being created at run time, so I will just add a handler for the Panel.

That's what you said in first post, and I understood that. I explained that for the TableLayoutPanel control to take mouse input such as wheel scroll it must have input focus, to achieve this you can call its Focus method, the time this should happen is when mouse enters the control which is when MouseEnter event happens. Does this makes any sense to you?

Yes it does, thanks!
sorry for that I annoyed you.
 
Back
Top