ListBox - mostrando linhas longas como um hint |
Top Previous Next |
|
Long ListBox entries as Hints
{ Sometimes the data you want to display in a list is too long for the size of ListBox you can use. When this happens, you can use the simple code to display the ListBox entries as Hints when the mouse passes over the ListBox. Just make sure that ShowHints is True. }
procedure TForm1.ListBox1MouseMove (Sender: TObject; Shift: TShiftState; X, Y: Integer); var lstIndex : Integer ; begin with ListBox1 do begin lstIndex:=SendMessage(Handle, LB_ITEMFROMPOINT, 0, MakeLParam(x,y)); if (lstIndex >= 0) and (lstIndex <= Items.Count) Then Hint := Items[lstIndex] else Hint := '' end; end; end.
|