C# 鼠标悬停在datagridview的某单元格,显示悬浮框效果
今天在做项目时,看到一软件做的悬浮框效果不错,从网上搜罗了一些资料,未见到有十分好的解决办法,只能自已动手,利用datagridview 的ToolTipText
来达到此效果。
以下是我简单实现的代码,供参考。后续会再仔细测试,如有问题,会一并作更新:
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的某单元格,显示悬浮框效果的更多相关文章
- 设置DataGridView的某个单元格为ComboBox
怎么将DataGridView的 某个单元格设为ComboBox的样式而不是整列都改变样式? 1.最简单的方法:利用DataGridView提供的DataGridViewComboBoxCell. 写 ...
- DataGridView单元格显示GIF图片
本文转载:http://home.cnblogs.com/group/topic/40730.html DataGridView单元格显示GIF图片 gifanimationindatagrid.ra ...
- EasyUI datagrid单元格文本超出显示省略号,鼠标移动到单元格显示文本
nowrap : true; 是前提 $('#×××').datagrid({ nowrap : true,//设置为true,当数据长度超出列宽时将会自动截取 }); 省略号样式: <sty ...
- DataGridView单元格显示密码
DataGridView单元格显示密码 private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormatt ...
- 工作总结 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 ...
- WinForm中DataGridView复制选中单元格内容解决方案
WinForm中DataGridView鼠标选中单元格内容复制方案 1.CTR+C快捷键复制 前提:该控件ClipboardCopyMode属性设置值非Disable: 2.鼠标框选,自定义代码实现复 ...
- Windows Forms DataGridView中合并单元格
Windows Forms DataGridView 没有提供合并单元格的功能,要实现合并单元格的功能就要在CellPainting事件中使用Graphics.DrawLine和 Graphics.D ...
- DataGridView 获取当前单元格
获取DataGridview控件中的当前单元格,是通过DataGridview的Rows属性和Column属性的索引来取得的,他们的索引都是从0开始的. Private void datagridvi ...
- C# DataGridView中合并单元格
/// 合并GridView列中相同的行 /// /// GridView对象 /// 需要合并的列 public static void GroupRows(GridView GridView1, ...
随机推荐
- C++学习34 模板类
C++除了支持模板函数,还支持模板类.模板类的目的同样是将数据类型参数化. 声明模板类的语法为: template<typename 数据类型参数 , typename 数据类型参数 , …&g ...
- redis在windows上的安装
1.下载地址:https://github.com/MSOpenTech/redis 主要支持win64的,有个msi文件可以直接安装,安装后redis会变成一个服务,对于windows来说这种最方便 ...
- [Other] 自定义MIME类型支持FLV的相关设置
刚测试知道为何服务器无法播放flv的原因,特此记录而已. 网络空间支持FLV的相关设置,就是自定义一个MIME类型,一般虚拟主机管理里面都有这个选项 自定义MIME类型 扩展名: .flv MIME类 ...
- ElasticSearch 常用的查询过滤语句
query 和 filter 的区别请看: http://www.cnblogs.com/ghj1976/p/5292740.html Filter DSL term 过滤 term主要用于精确匹配 ...
- 如何获取SQL Server 2008数据库数据文件的位置
在SQL Server中,要获取数据库数据文件的物理位置,有三种方法: sp_helpdb bright name filename f ...
- esriSRGeoCS3Type Constants
ArcGIS Developer Help (Geometry) esriSRGeoCS3Type Constants More available geographic coordinat ...
- POJ 2104 【主席树】【区间第K大】
#include<stdio.h> #include<algorithm> #include<string.h> #define MAXN 100010 #defi ...
- DNS加速
http://elingwange.iteye.com/blog/1563497 http://blog.csdn.net/lize1988/article/details/10404645 java ...
- router os
http://www.oschina.net/news/47568/router-operation-system
- 关于WinCE流接口驱动支持10以上的端口号(COM10)
一般情况下,WinCE流驱动的索引为0~9.应用程序中,通过CreateFile(_T("XXXN:"),…)打开对应的驱动,N也为0~9.这样看来,似乎在WinCE下同名流驱动个 ...