2015.1.4 判断鼠标点击DataGridView的第几行还是空白处
2024-09-04 00:21:43
public int GetRowIndexAt(int mouseLocation_Y)
{
if (dvaw.FirstDisplayedScrollingRowIndex < 0)
{
return -1;
}
if (dvaw.ColumnHeadersVisible == true && mouseLocation_Y <= dvaw.ColumnHeadersHeight)
{
return -1;
}
int index = dvaw.FirstDisplayedScrollingRowIndex;
int displayedCount = dvaw.DisplayedRowCount(true);
for (int k = 1; k <= displayedCount; )
{
if (dvaw.Rows[index].Visible == true)
{
Rectangle rect = dvaw.GetRowDisplayRectangle(index, true); // 取该区域的显示部分区域
if (rect.Top <= mouseLocation_Y && mouseLocation_Y < rect.Bottom)
{
return index;
}
k++;
}
index++;
}
return -1;
}
最新文章
- java cookie 工具类
- linux centos yum安装LAMP环境
- 递归练习(C语言)
- elasticsearch1.0 升级2.2的数据备份和恢复
- 安卓4.0下rem显示不正常的问题
- asp.net DropDownList无刷新ajax二级联动实现详细过程
- 在地图上添加POI(二)
- 深度剖析:CDN内容分发网络技术原理--转载
- 莱特币ltc在linux下的多种挖矿方案详解
- perl 自动登陆网站发短信
- 使用AndroidFrameworks开发和应用隐藏类 or Android使用自定义framework开发与应用
- [Usaco2008 Dec]Hay For Sale 购买干草[01背包水题]
- CLR类型设计之方法与构造器
- 【架构篇】OCP和依赖注入
- 使用JdbcTemplate 操作PostgreSQL,当where条件中有timestamp类型时,报错operator does not exist: timestamp w/out timezone
- JS(JavaScript)的进一步了解5(更新中&#183;&#183;&#183;)
- AI之旅(6):神经网络之前向传播
- (转)用JS获取地址栏参数的方法(超级简单)
- 在C语言中不使用任何中间变量如何将a、b的值进行交换(三种方法)——来自一小萌新工程师的复习
- Python实现邮件的批量发送