Kontakt
DSVGO
Private Sub Form_Load() Dim i As Long For i = 1 To 5 List1.AddItem "ein sehr langer text mit Nummer: " & i Next i End Sub Private Sub List1_MouseMove(Button As Integer, _ Shift As Integer, X As Single, Y As Single) ListBoxToolTip List1, Y, "(leer)" End Sub
Private Sub ListBoxToolTip( _ ByRef lst As ListBox, _ ByVal Y As Single, _ Optional ByRef DefaultToolTip As String = "" _ ) Dim Index As Long Dim ParentFont As StdFont With lst 'Font anpassen & Index bestimmen: With .Parent Set ParentFont = .Font Set .Font = lst.Font Index = Y \ .TextHeight("") Set .Font = ParentFont End With 'Index auswerten: Index = Index + .TopIndex If Index < .ListCount Then .ToolTipText = .List(Index) Else .ToolTipText = DefaultToolTip End If End With End Sub
© Jost Schwider, 29.12.2000-29.12.2000 - http://vb-tec.de/lst_tt.htm