MouseWheel event doesn't fire on TabPage
I have some controls on a tabPage (tabControl control) so that I have there a scroll bar. When I run my program, mouse wheel doesn't work. I added tabPage1_MouseWheel event to see if it is firing up, but it is not.
I need your help to fix it or explain it.
Thanks.
Victor
Re: MouseWheel event doesn't fire on TabPage
Quote:
Originally Posted by vkuzmich
I have some controls on a tabPage (tabControl control) so that I have there a scroll bar. When I run my program, mouse wheel doesn't work. I added tabPage1_MouseWheel event to see if it is firing up, but it is not.
I need your help to fix it or explain it.
Thanks.
Victor
umm the event wont fire unless tabPage1 or a control in tabPage1 is the control which has the focus. I'm not really sure what a good solution to this would be, but what I thought of is to manually set the focus on tabPage1 as the mouse enters it.
Code:
private void tabPage1_MouseEnter(object sender, System.EventArgs e)
{
foreach (Control ctrl in tabPage1.Controls)
{
if (ctrl.Focused)
return;
}
tabPage1.Focus();
}
what this does is that it checks to see if any control in tabPage1 has the focus, if so then do nothing because the mouseWheel event should fire. It not, then set the focus on tabpage1
not the best solution in my opinion, I just dont know any other way