gridview 设置某个单元格焦点

this.gridView1.ClearSelection();
this.gridView1.Focus();
this.gridView1.FocusedRowHandle = 0;//这地方是第0行 可以用 this.gridView1.FocusedRowHandle+1;
this.gridView1.FocusedColumn = this.gridView1.Columns["ID"];//要设置的列
this.gridView1.SelectRow(0);

 

gridview 快捷菜单

int[] selectedRows = this.gridView1.GetSelectedRows();
if (e.Button == MouseButtons.Right && selectedRows.Length > 0
&& selectedRows[0] >= 0 && this.gridView1.DataSource != null)
this.contextMenuStrip2.Show(Control.MousePosition);

 

gridview布局保存

gv.SaveLayoutToXml(path + file);//保存布局

gv.RestoreLayoutFromXml(path + file);//恢复默认

 

相关文章:

  • 2021-05-20
  • 2021-05-29
  • 2021-08-25
  • 2021-06-15
  • 2022-01-09
  • 2021-06-28
  • 2021-09-13
猜你喜欢
  • 2022-12-23
  • 2021-10-05
  • 2021-07-05
  • 2021-12-18
相关资源
相似解决方案