The ToolTipController component allows you to manage tooltip behavior for DevExpress Windows Forms UI controls.
This example handles the ToolTipController.GetActiveObjectInfo event to forcibly display tooltips for grid cells with non-trimmed content (value). The event handler creates and initializes a tooltip object if the e.Info
event parameter is null
and the mouse pointer is over a grid cell.
Files to Review
Documentation
Does this example address your development requirements/objectives?
(you will be redirected to DevExpress.com to submit your response)
Example Code
C#using System;
using DevExpress.Utils;
using System.Windows.Forms;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
namespace AlwaysShowCellHints {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
InitData();
}
public void InitData() {
recordBindingSource.DataSource = DataHelper.GetData(10);
}
private void toolTipController1_GetActiveObjectInfo(object sender, ToolTipControllerGetActiveObjectInfoEventArgs e) {
if(e.Info == null && e.SelectedControl == gridControl1) {
GridView view = gridControl1.FocusedView as GridView;
GridHitInfo info = view.CalcHitInfo(e.ControlMousePosition);
if(info.InRowCell) {
string text = view.GetRowCellDisplayText(info.RowHandle, info.Column);
string cellKey = info.RowHandle.ToString() + " - " + info.Column.ToString();
e.Info = new ToolTipControlInfo(cellKey, text);
}
}
}
}
}