ComponentOne SuperTooltip for WinForms
Work with SuperTooltip / Custom Processing
In This Topic
    Custom Processing
    In This Topic

    The SuperToolTip supports custom processing by displaying supertooltip for MS DataGridView's cell or ListView's item instead of showing the cell's or item's own tooltip text. For this, you can use UseCellTips property of the C1SuperTooltipBase class, which indicates whether the tooltip should display ToolTip text of Microsoft's DataGridView cells or Microsoft's ListView items.

    To display supertooltip instead of cell's tooltip text in MS DataGridView, you need to assign a supertooltip to the DataGridView using the SetToolTip method, enable the supertooltip by setting the UseCellTips property to True, and disable DataGridView's cell tooltip by setting ShowCellTooltips property to false as showcased in the following code:

    C#
    Copy Code
    private void Form1_Load(object sender, EventArgs e)
    {
        //default tooltip
        dataGridView1.Rows[0].Cells[0].ToolTipText = "Cell (1,1) tooltip";
        //bold text
        dataGridView1.Rows[0].Cells[1].ToolTipText = "<b>Cell (1,2) tooltip</b>";
        //styled with html
        dataGridView1.Rows[0].Cells[2].ToolTipText = "<span style=\"color:#0000ff;\">Cell (1,3) tooltip</span>";           
        dataGridView1.Rows[0].Cells[3].ToolTipText = "<span style=\"color:#ff0000;font-family:Helvetica;font-size:16;\"><b>Cell (1,4) tooltip</b></span>";
     
        //tooltips for rows and columns headers
        dataGridView1.Columns[0].ToolTipText = "ColumnTip";
        dataGridView1.Columns[0].HeaderCell.ToolTipText = "Col1 Header ToolTip";
        dataGridView1.Columns[1].HeaderCell.ToolTipText = "<span style=\"color:#0000ff;\">Col2 Header ToolTip</span>";
        dataGridView1.Columns[2].HeaderCell.ToolTipText = "<b>Col3 Header ToolTip</b>"; 
        dataGridView1.Rows[0].HeaderCell.ToolTipText = "Row Header ToolTip";
        dataGridView1.TopLeftHeaderCell.ToolTipText = "Topleft ToolTip";
    
        // Assign supertooltip to specific control, here, DataGridView
        c1SuperTooltip1.SetToolTip(dataGridView1, "<table><tr>" +
        "<th>DataGridView SuperTooltip</th>" + "</tr></table>");
        //We can also set an empty SuperTooltip for dataGridView1 - in this case, only cell tooltips will be shown.
        //c1SuperTooltip1.SetToolTip(dataGridView1, "");
        
        // Enable showing supertooltip for DataGridView cells
        c1SuperTooltip1.UseCellTips = true;
        //Disable showing MS DataGridView's cell tips
        dataGridView1.ShowCellToolTips = false;
    }
    

    To enable different text for different cells in the SuperTooltip, the user should set the standard ToolTipText for DataGridView cells. User can also use html tags in ToolTipText as these will be processed by the SuperTooltip.

    You can also show the MS DataGridView ColumnHeaderCell's, RowHeaderCell's or TopLeftCell's tooltips as C1SuperTooltip if these are set.