Re: User Control Mouse Hover - Covered by Controls



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.
.



Relevant Pages

  • Re: Writing Access functions
    ... Otherwise, create a sub. ... Control sources, Macros (thought the only one you should be using is the ... Public Function NameFromIDAs String ...
    (microsoft.public.access.modulesdaovba)
  • Re: Writing Access functions
    ... passing values by Value or by Reference. ... Public Function NameFromIDAs String ... If you pass a control reference: ...
    (microsoft.public.access.modulesdaovba)
  • Re: Writing Access functions
    ... Public Function NameFromIDAs String ... Dim strName As String ... If you pass a control reference: ...
    (microsoft.public.access.modulesdaovba)
  • RE: Passing form values to module
    ... Do I put this Function in my form code? ... Public Function GetControlText(ByRef ctl As Control) As String ... Public Function GetFormRecordsourceAs String ...
    (microsoft.public.access.modulesdaovba)
  • RE: Passing form values to module
    ... Public Function GetControlText(ByRef ctl As Control) As String ... Public Function GetFormRecordsourceAs String ... strCallingProc As String, strFieldName As String, strTableName As String) ...
    (microsoft.public.access.modulesdaovba)