Example E714
Visible to All Users

WinForms Data Grid - How to display tooltips for grid cells if cell content is completely visible

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.

Display Tooltips for WinForms Data Grid Cells

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

AlwaysShowCellHints/Form1.cs(vb)
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); } } } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.