2020年5月22日 星期五

vb.net 在 Listview 裡使用 ToolTips 來顯示說明 [Listview add Tooltips for information]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    Private Sub ListView1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles ListView1.MouseDoubleClick
        If ListView1.HitTest(e.Location).Item Is Nothing Then

        Else

            ToolTip1.IsBalloon = False
            Dim pntLocation As Point = New Point(e.Location.X - 20, e.Location.Y - 20)

            'ToolTip1.IsBalloon = True
            'Dim pntLocation As Point = New Point(e.Location.X - 14, e.Location.Y - 44)

            'ToolTip1.IsBalloon = False
            'Dim pntLocation As Point = New Point(ListView1.HitTest(e.Location).Item.GetSubItemAt(e.X, e.Y).Bounds.X + 5, ListView1.HitTest(e.Location).Item.GetSubItemAt(e.X, e.Y).Bounds.Y - 20)


            ToolTip1.Show("已複製", sender, pntLocation, 1000)

            '另一個方式
            'Dim ht As ListViewHitTestInfo = ListView1.HitTest(e.Location)
            'ToolTip1.Show(ListView1.HitTest(e.Location).Item.SubItems(1).Text, sender, ListView1.HitTest(e.Location).Item.Bounds.Location, 2000)

        End If
    End Sub

沒有留言:

張貼留言