zoukankan      html  css  js  c++  java
  • 2015.1.4 判断鼠标点击DataGridView的第几行还是空白处

    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;

            }

  • 相关阅读:
    软件测试(来自于网络)
    selenium常用命令
    新员工入门
    常用测试点
    测试leader职责
    软件测试 —— 用例设计4(读书分享)
    Tomcat 基础二
    Github Pull Request的提出与采纳
    Unix套接字接口
    健壮的I/O(RIO)
  • 原文地址:https://www.cnblogs.com/mol1995/p/5964804.html
Copyright © 2011-2022 走看看