我写了一个菜单项,当点击右键时 对dataGrid中某一行的数据进行编辑,dataGrid中当点击鼠标右键时 并不能选中一行数据, 希望得到大家的帮助
解决方案 »
- Winform 使用BackgroundWorker组件,Background work时如何禁止界面操作
- c#怎样调用一个exe程序,并接收程序结束时返回的参数?
- public string Path = "c:\";
- 求教一个简单的问题,我快要狂暴了。。。。。啊
- 用户控件的问题
- Javascript高级问题(倾家荡产求超级高手)
- 如何用C#的datagridview提交修改后的数据到指定的数据库表?
- 求思路,我怎么把以下的htm代码中的table输出一个Excel文件
- 求C#套打纯代码
- 关于remoting的问题
- 乱码的问题,折腾两天了,还是解决不了,思归,孟子,秋枫等高人请进
- 用ADO.NET写用户认证
{
if (e.Button == MouseButtons.Right)
{
this.dataGridView1.CurrentCell = this.dataGridView1[e.ColumnIndex, e.RowIndex];
}
}
在WinForm 中找不到这个事件啊!
private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
this.dataGridView1.CurrentCell = this.dataGridView1[e.ColumnIndex, e.RowIndex];
}
}
你试试this.DataGrid1.select(this.DataGrid1.CurrentRowIndex)
{
if (e.Button == MouseButtons.Right)
{
Point pt = new Point(e.X,e.Y);
DataGrid.HitTestInfo hit = dataGrid1.HitTest(pt);
if(hit.Type == DataGrid.HitTestType.Cell)
{
dataGrid1.Select(hit.Row);
}
}
}
{
if(e.Button==System.Windows.Forms.MouseButtons.Right)
{
this.dataGrid.CurrentRowIndex = hit.Row ;
this.m_ContextMenu.Show(this.dataGrid,new Point(e.X,e.Y)) ;
}
}