如何在datagridview的当前单元格中(靠一边)显示一个命令按钮?
当在datagridview的一个单元格获得焦点时,在单元格的一边显示一个命令按钮,当焦点离开该单元格时,命令按钮不显示,如何实现这个功能,请各位高手出手相助,不吝赐教,在下不胜感激!
2011-07-01 08:46
2011-07-01 10:45
2011-07-01 10:48

2011-07-01 11:06
2011-07-01 15:56
2011-07-01 16:49
程序代码: Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
If e.ColumnIndex = -1 Or e.RowIndex = -1 Then Exit Sub
Dim a As New Button
Dim GetRect As New Rectangle
GetRect = DataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, True)
Me.DataGridView1.Controls.Add(a)
a.Text = "修改"
a.SetBounds(GetRect.Left + GetRect.Width * 2 / 3, GetRect.Top, GetRect.Width / 3, GetRect.Height)
a.Show()
End Sub
2011-07-01 16:59
2011-07-01 17:47
2011-07-02 09:36

2011-07-02 15:02