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显示
            }

  • 相关阅读:
    Base64 编解码
    MFC:CTime类和CTimeSpan类
    VC对话框实现添加滚动条实现滚动效果
    组合框控件 -- CComboBox
    快速排序
    归并排序
    插入排序
    堆排序
    Mozilla新特性只支持https网站,再次推动SSL证书普及
    企业如何选择最佳的SSL
  • 原文地址:https://www.cnblogs.com/jamse/p/3381553.html
Copyright © 2011-2022 走看看