This example handles the ToolTipController.GetActiveObjectInfo event to configure and display a tooltip for a list item on mouse hover. The example uses the ListBoxControl.IndexFromPoint method to get the item under the mouse pointer.
public Form1() {
InitializeComponent();
listBoxControl1.ToolTipController = toolTipController1;
toolTipController1.GetActiveObjectInfo += toolTipController1_GetActiveObjectInfo;
}
private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e) {
ListBoxControl listBoxControl = e.SelectedControl as ListBoxControl;
if (listBoxControl == null)
return;
int index = listBoxControl.IndexFromPoint(e.ControlMousePosition);
if (index != -1) {
string item = listBoxControl.GetItem(index) as string;
object obj = index.ToString() + item;
e.Info = new DevExpress.Utils.ToolTipControlInfo(obj, item);
}
}