Re: User Control Mouse Hover - Covered by Controls
- From: Spam Catcher <spamhoneypot@xxxxxxxxxx>
- Date: Sun, 29 Jul 2007 16:56:02 GMT
Spam Catcher <spamhoneypot@xxxxxxxxxx> wrote in
news:Xns997C1792CBB95usenethoneypotrogers@xxxxxxxxx:
Hi all,
I'm having some trouble with the Mouse Hover/Leave events on a user
control.
I solved the problem - I implemented IMessageFilter in the User Control:
1. In the constructor you need to register the message filter:
Application.AddMessageFilter(me)
2. Const WM_MOUSEMOVE As Integer = &H200
3.
Public Function PreFilterMessage(ByRef m As
System.Windows.Forms.Message) As Boolean Implements
System.Windows.Forms.IMessageFilter.PreFilterMessage
If m.Msg = WM_MOUSEMOVE Then
If Me.ClientRectangle.Contains(Me.PointToClient
(Control.MousePosition)) Then
Me.BackColor = System.Drawing.SystemColors.Highlight
Else
Me.BackColor = System.Drawing.SystemColors.Control
End If
End If
End Function
This solution is probably the best (?) because there is no flickering
involved.
.
- Follow-Ups:
- Re: User Control Mouse Hover - Covered by Controls
- From: Cor Ligthert[MVP]
- Re: User Control Mouse Hover - Covered by Controls
- References:
- User Control Mouse Hover - Covered by Controls
- From: Spam Catcher
- User Control Mouse Hover - Covered by Controls
- Prev by Date: Re: vb 2005, listview
- Next by Date: Access DB Path
- Previous by thread: User Control Mouse Hover - Covered by Controls
- Next by thread: Re: User Control Mouse Hover - Covered by Controls
- Index(es):
Relevant Pages
|