怎样右击DataGridView行时,选中这行的数据啊?

yuesongboy 2007-02-07 09:20:30
怎样右击DataGridView行时,选中这行的数据啊?
...全文
222 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wpsni 2008-05-28
  • 打赏
  • 举报
回复
列呢?
learnall 2007-02-07
  • 打赏
  • 举报
回复
楼上正解!
bigrongshu 2007-02-07
  • 打赏
  • 举报
回复
private void dataGridView1_CellMouseUp(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
{
if (e.Button != MouseButtons.Right || e.RowIndex < 0)
return;

if (this.dataGridView1.SelectedRows.Count > 0)
{
for (int i = 0; i < this.dataGridView1.SelectedRows.Count; i++)
this.dataGridView1.SelectedRows[i].Selected = false;
}

this.dataGridView1.Rows[e.RowIndex].Selected = true;
}

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧