VB.NET質問スレ (Part21) at TECH
VB.NET質問スレ (Part21) - 暇つぶし2ch367:デフォルトの名無しさん
07/05/25 21:01:44
>>363
希望するのはこういう動作?

  Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
    MyBase.OnLoad(e)
    For Each c As Control In Me.Controls
      AddHandler c.MouseMove, AddressOf Chileds_MouseMove
      AddHandler c.MouseLeave, AddressOf Chileds_MouseLeave
    Next
  End Sub

  Private Sub Chileds_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
    Dim pt As Point = MousePositionByClientCoordinate()
    Dim ev As New MouseEventArgs(e.Button, e.Clicks, pt.X, pt.Y, e.Delta)
    MyClass.OnMouseEnter(New EventArgs)
    Me.OnMouseMove(ev)
  End Sub

  Private Sub Chileds_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs)
    MyClass.OnMouseLeave(New EventArgs)
  End Sub

  Private Function MousePositionByClientCoordinate() As Point
    Return Me.PointToClient(Control.MousePosition)
  End Function

  Private Function IsMouseOnMe() As Boolean
    Dim pt As Point = MousePositionByClientCoordinate()
    Return Me.ClientRectangle.Contains(pt)
  End Function


次ページ
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch