我正在尝试编写一个函数来确定鼠标是否在像素范围内(特定控件的像素范围)
问题是该功能仅适用于 的边界Form
,不适用于按钮或我测试过的任何其他控件......我错过了什么?
''' <summary>
''' Determinates whether the mouse pointer is over a pixel range of the specified control.
''' </summary>
''' <param name="Control">The control.</param>
''' <returns>
''' <c>true</c> if mouse is inside the pixel range, <c>false</c> otherwise.
''' </returns>
Private Function MouseIsOverControl(ByVal [Control] As Control) As Boolean
Return [Control].Bounds.Contains(MousePosition)
End Function
PS:我知道鼠标事件的用法,但是这个函数是通用的。