今天在做项目时,看到一软件做的悬浮框效果不错,从网上搜罗了一些资料,未见到有十分好的解决办法,只能自已动手,利用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. C++学习32 重载new和delete运算符

    内存管理运算符 new.new[].delete 和 delete[] 也可以进行重载,其重载形式既可以是类的成员函数,也可以是全局函数.一般情况下,内建的内存管理运算符就够用了,只有在需要自己管理内 ...

  2. 创建一个hibernate helloword

    1.下载hibernate包 http://hibernate.org/orm/ 点download下载最终版 安装hibernate插件hibernatetools 2.创建一个java工程 导入必 ...

  3. 苹果safari浏览器登陆时Cookie无法保存的问题

    Safari浏览器不支持将非ASCII字符存入Cookie,所以中文在保存的时候就会出问题,分号(";")也不能存在Cookie中,所以需要通过方法去除内容中的分号,在Cookie ...

  4. Linux(Ubuntu)下MySQL的安装与配置

    转自:http://www.2cto.com/database/201401/273423.html 在Linux下MySQL的安装,我一直觉得挺麻烦的,因为之前安装时就是由于复杂的配置导致有点晕.今 ...

  5. datetime时区转换

    http://www.dannysite.com/blog/122/ Python标准库中的datetime模块提供了各种对日期和时间的处理方法.从本文的主题着手,首先利用datetime中提供的ut ...

  6. hibernate one-to-many many-to-one 双向注解

    建表语句: DROP TABLE IF EXISTS `t_company`; CREATE TABLE `t_company` ( `companyId` ) unsigned NOT NULL A ...

  7. Mplayer 官方中文手册

    MPlayer 名称总览描述交互式控制用法配置文件配置集通用选项播放器选项(仅适用于MPLAYER)分离器/媒体流选项OSD/字幕选项音频输出选项(仅适用于MPLAYER)音频输出驱动(仅适用于MPL ...

  8. Unity球形插值Slerp解析

    Unity球形插值,官方有个太阳升降的例子: http://docs.unity3d.com/ScriptReference/Vector3.Slerp.html 一开始主观认为这个球形插值Slerp ...

  9. 【LeetCode】8. String to Integer (atoi) 字符串转整数

    题目: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input ca ...

  10. 能在手机播放的Flash代码

    有些使用Flash的广告图片变换代码在手机不支持,在网上搜到了一个解决的方法: Flash嵌入处: <iframe style="width:474px;height:276px; b ...