PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Problem with TabAlignment and button mouse enter/leave events
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Problem with TabAlignment and button mouse enter/leave events
![]() |
Problem with TabAlignment and button mouse enter/leave events |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hello,
I encountered a strange problem and I do not know what is causing it. I created an empty form, added a tabs control to it and set the tab control dock style to fill. Then I added three tabpages to it. To the first tab page I added three buttons. The first button's click handler would set the tab control's tab alignment to TabAlignment.Left and the second buttons click handler would set it to Bottom. I added mouse enter and mouse leave handlers to the third button. Whenever the mouse would enter the button, I would change its background color to yellow. When the mouse leaves the button, I would set the color back to its original state. Now, when I start the form, the mouse enter/leave events work great and everything is fine. However, once I change the tabs alignment by hitting one of the first two buttons, the third button no longer fires it's mouse leave event and only fires the mouse enter event once. The mouse enters and mouse enter fires correctly, but it seems that the mouse leave event has been unregistered when the tab control's tab alignment changed. Does anyone know what can be causing this behavior? Thanks, -Flack |
|
|
|
#2 |
|
Guest
Posts: n/a
|
It's a problem with any standard .net control and happens when the controls
Container is assigned a new handle. Changing the TabAlignment cuases the TabControl to be destroyed and recreated, resulting in a new handle. You'll probably be better off coding in the MouseMove method of the button and it's container. -- Mick Doherty http://dotnetrix.co.uk/nothing.html "Flack" <Flack@discussions.microsoft.com> wrote in message news:4F8B06F6-424D-48D8-81A3-6AD2214566AD@microsoft.com... > Hello, > > I encountered a strange problem and I do not know what is causing it. > > I created an empty form, added a tabs control to it and set the tab > control > dock style to fill. Then I added three tabpages to it. To the first tab > page > I added three buttons. The first button's click handler would set the tab > control's tab alignment to TabAlignment.Left and the second buttons click > handler would set it to Bottom. > > I added mouse enter and mouse leave handlers to the third button. Whenever > the mouse would enter the button, I would change its background color to > yellow. When the mouse leaves the button, I would set the color back to > its > original state. > > Now, when I start the form, the mouse enter/leave events work great and > everything is fine. However, once I change the tabs alignment by hitting > one > of the first two buttons, the third button no longer fires it's mouse > leave > event and only fires the mouse enter event once. The mouse enters and > mouse > enter fires correctly, but it seems that the mouse leave event has been > unregistered when the tab control's tab alignment changed. > > Does anyone know what can be causing this behavior? > > Thanks, > -Flack |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

