我想当我点击dataGridView的Currentcell的时候,就在Currentcell的底边显示一个panel,请问各路大神,我该怎么做

解决方案 »

  1.   

    在Currentcell事件里面写
    先确定找到是哪个Currentcell
    然后在new 一个panel 
      

  2.   

    在底边显示一个panel  ^^……^
      

  3.   

    试下 dataGridView.CurrentCell.ToolTipText,这个属性是不是你需要的,可以在事件里赋值下试试
      

  4.   

    底边显示一个panel?什么意思?
      

  5.   

    private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
      {
      string s=dataGridView1.Rows[dataGridView1.CurrentRow.Index ].Cells["id"].Value.ToString();
    //动态添加panel
      }
      

  6.   

    他是要panel显示在datagridview里,老大怎么解决控件重叠的问题???
      

  7.   

            int q = 0;
            private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
            {
                q++;
                if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
                {
                    int h1 = dataGridView1.Location.Y + dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Size.Height * (1 + e.RowIndex);
                    int w1 = dataGridView1.Location.X + dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Size.Width * (1 + e.ColumnIndex);
                    Panel p = new Panel();
                    p.Name = "p" + q.ToString();
                    p.Location = new System.Drawing.Point(w1, h1);
                    p.Size = new System.Drawing.Size(100, 100);
                    p.BackColor = Color.Black;
                    this.Controls.Add(p);
                }
            }
    我写的,不过问题挺多
    1)位置不好确定,datagridview中的行列标头的大小不知道怎么获取
    2)panel在datagridview之下,不知道怎么控制层叠关系