C # DataGridView Displays the full cell contents in the cell hint (tooltip)

Source: Internet
Author: User

When the cell contents are too long, the following is ignored

Solution: Add DGV when mouse moves to a cell event, setthe contents of the current cell's ToolTipText property areCurrent cell contents
voidFrom_load (Objectsender, EventArgs e) {     This. dgvsystemlog.showcelltooltips =true;  This. Dgvsystemlog.cellmouseenter + =NewDatagridviewcelleventhandler (dgvsystemlog_cellmouseenter);}/// <summary>///set the current cell's ToolTipText property content to the current cell when you move the mouse over the cell///solve the problem of tip content not displaying completely/// </summary>/// <param name= "Sender" ></param>/// <param name= "E" ></param>voidDgvsystemlog_cellmouseenter (Objectsender, DataGridViewCellEventArgs e) {    if(E.columnindex <0|| E.rowindex <0|| DgvSystemLog.Rows.Count <=0)return; Dgvsystemlog.rows[e.rowindex]. Cells[e.columnindex]. ToolTipText= (Dgvsystemlog.rows[e.rowindex]. Cells[e.columnindex]. Value??string. Empty). ToString ();}

the effect after the change:


Reference: Http://stackoverflow.com/questions/22626802/how-to-increase-the-length-of-tooltip-in-datagridview-in-winforms

From for notes (Wiz)

C # DataGridView Displays the full cell contents in the cell hint (tooltip)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.