禁用某些单元格的工具提示 [英] Disabling tooltip for certain cells

查看:76
本文介绍了禁用某些单元格的工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的Windows窗体中有一个gridview.现在,我使用以下代码显示自定义工具提示,

Hi,,
I have one gridview in my windows form. Now i''m showing custom tooltip using the following code,

private void Audit_Dg_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
          if (e.ColumnIndex == 7 || e.ColumnIndex == 8 || e.ColumnIndex == 10 || e.ColumnIndex == 11 && e.RowIndex >= 0)
          {           
              DataGridViewCell cell = this.Audit_Dg.Rows[e.RowIndex].Cells[e.ColumnIndex];

              cell.ToolTipText = "Click Here To View The Message";


          }
}


它显示了我对那些满足我条件的单元格的信息,而所有那些不满足我条件的单元格的内容.有什么方法可以从我的网格视图中删除该工具提示,并仅显示我的自定义工具提示?
如果有任何方法,请帮助我...


it showing my message for those cells satisfying my condition and the cell content for all those doesn''t satisfying my condition. is there any way to remove that tool-tips from my grid-view and show only my custom tool-tip?
if there any way,please help me...

推荐答案

您只需在当前代码中添加一些代码即可:
You have to add just a little code in you current code:
private void Audit_Dg_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
          if (e.ColumnIndex == 7 || e.ColumnIndex == 8 || e.ColumnIndex == 10 || e.ColumnIndex == 11 && e.RowIndex >= 0)
          {           
              DataGridViewCell cell = this.Audit_Dg.Rows[e.RowIndex].Cells[e.ColumnIndex];
 
              cell.ToolTipText = "Click Here To View The Message";
 

          }
         //Add this else condition in your code
          else
          {
            cell.ToolTipText = String.Empty;
          }
}


这篇关于禁用某些单元格的工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆