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

来达到此效果。

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

  private void dgvProduct_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex != - && e.RowIndex != -)
{
if (ds1 != null && dgvProduct.CurrentRow.IsNewRow == false && dgvProduct.CurrentRow.Cells[].Value.ToString() != "")
{
if (dgvProduct[dgvProduct.CurrentCell.ColumnIndex, dgvProduct.CurrentCell.RowIndex].Value.ToString() != "")
{
dgvProduct[e.ColumnIndex, e.RowIndex].ToolTipText = "当前行基本信息:" + "\n";
dgvProduct[e.ColumnIndex, e.RowIndex].ToolTipText += " 全球唯一码:" + dgvProduct[, dgvProduct.CurrentCell.RowIndex].Value + "\n";
dgvProduct[e.ColumnIndex, e.RowIndex].ToolTipText += " 料号:" + dgvProduct[, dgvProduct.CurrentCell.RowIndex].Value + "\n";
dgvProduct[e.ColumnIndex, e.RowIndex].ToolTipText += " 名称:" + dgvProduct[, dgvProduct.CurrentCell.RowIndex].Value + "\n"; }
} }
}

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. 采用p6spy完整显示hibernate的SQL语句

    虽然在hibernate中有show_sql选项,但是显示出来的语句大多类似 select * from xxx where value=? 但是有时候我们需要得到完整的SQL语句,怎么办呢?使用P6 ...

  2. [HDU 1011] Starship Troopers (树形dp)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1011 dp[u][i]为以u为根节点的,花了不超过i元钱能够得到的最大价值 因为题目里说要访问子节点必 ...

  3. WIN7上搭建Windows Phone 8 开发环境——VMware Workstation下Win8 “无法安装Hyper-V, 某个虚拟机监控程序正在运行”问题解决的办法

    最近在试着在Windows 7上搭建Windows Phone 8的开发调试环境,使用的是VMware Workstation + Win8 Pro的虚拟环境, 在漫长的WPexpress_full下 ...

  4. Xcode自动注释插件

    开源xcode插件:规范注释生成器VVDocumenter 1.类似eclipse 和 vs studio 在前面输入/// 后触发,自动生成代码注释,如图 2.GitHub工程文件地址:https: ...

  5. 002..NET MVC实现自己的TempBag

    原文链接:http://www.dotnetbips.com/articles/bc422c95-02cc-4d05-9c5c-fa89d0e78cc0.aspx 1.前言 本来今天是想发那篇关于在W ...

  6. Swift学习(二)

    一.方法 在OC中,函数是C语言的形式,跟方法不一样 函数:int sum (int num1, int num2) { return num1 + num2;   } 方法:- (int)sum:( ...

  7. org.apache.ibatis.reflection.ReflectionException

    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti ...

  8. 多文件目录下makefile文件递归执行编译所有c文件

    首先说说本次嵌套执行makefile文件的目的:只需make根目录下的makefile文件,即可编译所有c文件,包括子目录下的. 意义:自动化编译行为,以后编译自己的c文件时可把这些makefile文 ...

  9. Some regret....

    今天是一个败笔,早上10点才起床,下午又不专心看书,晚上把还是不能静下来...... 把所有的时间都花在了那一篇FlowVisor上了,但是却没有任何收获,居然没看懂,等下好好整理一下逻辑. 明天开始 ...

  10. CLRS:build_max_heap(strorage in array)

    //用满二叉树存储,从n/2处开始递归向上调整(n/2后均为叶子节点,无需调整)使得根最大 //满二叉树顺序存储,左子2i,右子2i+1: #include<stdio.h>#includ ...