zoukankan      html  css  js  c++  java
  • DataGridView 取得当前单元格的内容实现模糊查找

    提醒:本方法主要是在一个界面不弹窗体情况下实现的

    private void dataGridView2_Click(object sender, EventArgs e)
            {
                dataGridView1.Rows[connectClass.form2X].Cells[connectClass.form2Y].Value = 
                    dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[2].Value.ToString();
                this.panel1.Visible = false;            //将panel再度隐藏
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                label1.Text = "button1 has click!";
            }
    
            private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
            {
                int dgvX = dataGridView1.Location.X;
                int dgvY = dataGridView1.Location.Y;
    
                int cellX = this.dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location.X 
                    + this.dataGridView1.Location.X;
                int cellY = this.dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location.Y
                    + this.dataGridView1.Location.Y;
    
                connectClass.form2X = e.RowIndex;
                connectClass.form2Y = e.ColumnIndex;                                 //获取要编辑单元格位置
                panel1.Location = new Point(cellX, cellY+25);                      //(全屏的情况下)获取当前修改单元格位置便于panel显示
                panel1.Visible = true;                                            //将panel显示
            }

  • 相关阅读:
    Apple Swift编程语言入门教程
    网络请求错误
    Mac使用大全
    MPMovieplayerController添加新控件
    ios9 新变化
    UITableView总结
    UINavigationController的简单学习
    HTML
    谓词(NSPredicate)
    NSString字符串
  • 原文地址:https://www.cnblogs.com/jamse/p/3381553.html
Copyright © 2011-2022 走看看