今天在做项目时,看到一软件做的悬浮框效果不错,从网上搜罗了一些资料,未见到有十分好的解决办法,只能自已动手,利用datagridviewToolTipText

来达到此效果。

以下是我简单实现的代码,供参考。后续会再仔细测试,如有问题,会一并作更新:

  1. private void dgvProduct_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
  2. {
  3. if (e.ColumnIndex != - && e.RowIndex != -)
  4. {
  5. if (ds1 != null && dgvProduct.CurrentRow.IsNewRow == false && dgvProduct.CurrentRow.Cells[].Value.ToString() != "")
  6. {
  7. if (dgvProduct[dgvProduct.CurrentCell.ColumnIndex, dgvProduct.CurrentCell.RowIndex].Value.ToString() != "")
  8. {
  9. dgvProduct[e.ColumnIndex, e.RowIndex].ToolTipText = "当前行基本信息:" + "\n";
  10. dgvProduct[e.ColumnIndex, e.RowIndex].ToolTipText += " 全球唯一码:" + dgvProduct[, dgvProduct.CurrentCell.RowIndex].Value + "\n";
  11. dgvProduct[e.ColumnIndex, e.RowIndex].ToolTipText += " 料号:" + dgvProduct[, dgvProduct.CurrentCell.RowIndex].Value + "\n";
  12. dgvProduct[e.ColumnIndex, e.RowIndex].ToolTipText += " 名称:" + dgvProduct[, dgvProduct.CurrentCell.RowIndex].Value + "\n";
  13.  
  14. }
  15. }
  16.  
  17. }
  18. }

C# 鼠标悬停在datagridview的某单元格,显示悬浮框效果的更多相关文章

  1. 设置DataGridView的某个单元格为ComboBox

    怎么将DataGridView的 某个单元格设为ComboBox的样式而不是整列都改变样式? 1.最简单的方法:利用DataGridView提供的DataGridViewComboBoxCell. 写 ...

  2. DataGridView单元格显示GIF图片

    本文转载:http://home.cnblogs.com/group/topic/40730.html DataGridView单元格显示GIF图片 gifanimationindatagrid.ra ...

  3. EasyUI datagrid单元格文本超出显示省略号,鼠标移动到单元格显示文本

    nowrap : true;  是前提 $('#×××').datagrid({ nowrap : true,//设置为true,当数据长度超出列宽时将会自动截取 }); 省略号样式: <sty ...

  4. DataGridView单元格显示密码

    DataGridView单元格显示密码 private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormatt ...

  5. 工作总结 1 sql写法 insert into select from 2 vs中 obj文件和bin文件 3 npoi 模板copy CopySheet 最好先全部Copy完后 再根据生成sheet写数据 4 sheet.CopyRow(rowsindex, rowsindex + x); 5 npoi 复制模板如果出现单元格显示问题

    我们可以从一个表中复制所有的列插入到另一个已存在的表中: INSERT INTO table2SELECT * FROM table1; 或者我们可以只复制希望的列插入到另一个已存在的表中: INSE ...

  6. WinForm中DataGridView复制选中单元格内容解决方案

    WinForm中DataGridView鼠标选中单元格内容复制方案 1.CTR+C快捷键复制 前提:该控件ClipboardCopyMode属性设置值非Disable: 2.鼠标框选,自定义代码实现复 ...

  7. Windows Forms DataGridView中合并单元格

    Windows Forms DataGridView 没有提供合并单元格的功能,要实现合并单元格的功能就要在CellPainting事件中使用Graphics.DrawLine和 Graphics.D ...

  8. DataGridView 获取当前单元格

    获取DataGridview控件中的当前单元格,是通过DataGridview的Rows属性和Column属性的索引来取得的,他们的索引都是从0开始的. Private void datagridvi ...

  9. C# DataGridView中合并单元格

    /// 合并GridView列中相同的行 /// /// GridView对象 /// 需要合并的列 public static void GroupRows(GridView GridView1, ...

随机推荐

  1. [ActionScript 3.0] Away3D 旋转效果

    package { import away3d.containers.View3D; import away3d.entities.Mesh; import away3d.events.MouseEv ...

  2. centos 下安装.net core

    先要安装libunwind, libunwind库为基于64位CPU和操作系统的程序提供了基本的堆栈辗转开解功能,32位操作系统不要安装.其中包括用于输出堆栈跟踪的API.用于以编程方式辗转开解堆栈的 ...

  3. tarjan 边双连通分量 对点进行分组 每组点都在一个双连通分量里边

    int dfn[N],low[N],id[N],s[N],p,num,t,son[N];//dfn记录dfs时间戳//low代表当前点到达的最小时间戳,id对点进行分组编号.num是时间戳//s临时存 ...

  4. ACM—最大连续子序列(HDOJ1003)

    HDOJ链接 http://acm.hdu.edu.cn/showproblem.php?pid=1003 不了解题目的朋友可以先看一下题目,在这里就不再详细介绍了.(文章内容和解题思路不完全相同,方 ...

  5. Android中Context详解 ---- 你所不知道的Context

    转自:http://blog.csdn.net/qinjuning/article/details/7310620Android中Context详解 ---- 你所不知道的Context 大家好,  ...

  6. iOS开发-文件管理(一)

    iOS开发-文件管理(一) 一.iOS中的沙盒机制 iOS应用程序只能对自己创建的文件系统读取文件,这个独立.封闭.安全的空间,叫做沙盒.它一般存放着程序包文件(可执行文件).图片.音频.视频.pli ...

  7. ANR

    /data/anr/traces.txt MySQL: select version();

  8. some tips

    1.在使用selenium的时候,需要等待页面加载完成,特别是一些ajax请求,最好使用以下方法(python),通过document.readyState来判断 from selenium.webd ...

  9. jmeter随笔(5)--断言中正则表达式的特殊字符问题和中文乱码显示问号的问题

    最近在工作中,对jmeter实践的点滴的记录,这里分享交流,不一定正确,仅供参考和讨论,有想法的欢迎留言.谈论,手机上图片如果不清晰,请点击[阅读原文]查看. 问题:今天QQ群一朋友遇到jmeter的 ...

  10. Wordpress SEO对策(译)

    原文link http://netaone.com/wp/wordpress-seo-plugin/ 统一管理SEO对策的设定能够统一管理SEO相关设定的插件:All in One SEO Pack. ...