DevExpress中的GridView(GRIDCONTROL)中的右键全选、反选、撤销、复制单元格值ContextMenuStrip

DevExpress中的GridView(GRIDCONTROL)中的右键全选、反选、撤销、复制单元格值ContextMenuStrip

2018年11月22日 11:25:41 mQney 阅读数 177

 
  1. #region 标本接收的右键

  2. private void 全选ToolStripMenuItem_Click(object sender, EventArgs e)

  3. {

  4. if (this._dtT_LIS_SAMPLERECEIVE_REPORTS == null || this._dtT_LIS_SAMPLERECEIVE_REPORTS.Rows.Count < 1) { return; }

  5. foreach (DataRow drT_LIS_SAMPLERECEIVE_REPORTS in this._dtT_LIS_SAMPLERECEIVE_REPORTS.Rows)

  6. {

  7. drT_LIS_SAMPLERECEIVE_REPORTS[TableField.V_SEL] = EnumYesNo.YES.ToString("d");

  8. }

  9. }

  10. private void 反选ToolStripMenuItem_Click(object sender, EventArgs e)

  11. {

  12. if (this._dtT_LIS_SAMPLERECEIVE_REPORTS == null || this._dtT_LIS_SAMPLERECEIVE_REPORTS.Rows.Count < 1) { return; }

  13. foreach (DataRow drT_LIS_SAMPLERECEIVE_REPORTS in this._dtT_LIS_SAMPLERECEIVE_REPORTS.Rows)

  14. {

  15. int i = 0;

  16. string strValue = drT_LIS_SAMPLERECEIVE_REPORTS[TableField.V_SEL] == null ? "" : drT_LIS_SAMPLERECEIVE_REPORTS[TableField.V_SEL].ToString();

  17. int.TryParse(strValue, out i);

  18. drT_LIS_SAMPLERECEIVE_REPORTS[TableField.V_SEL] = i ^ 1;

  19. }

  20. }

  21. private void 全撤ToolStripMenuItem_Click(object sender, EventArgs e)

  22. {

  23. if (this._dtT_LIS_SAMPLERECEIVE_REPORTS == null || this._dtT_LIS_SAMPLERECEIVE_REPORTS.Rows.Count < 1) { return; }

  24. foreach (DataRow drT_LIS_SAMPLERECEIVE_REPORTS in this._dtT_LIS_SAMPLERECEIVE_REPORTS.Rows)

  25. {

  26. drT_LIS_SAMPLERECEIVE_REPORTS[TableField.V_SEL] = EnumYesNo.NO.ToString("d");

  27. }

  28. }

  29.  
  30. private void 复制病历号ToolStripMenuItem_Click(object sender, EventArgs e)

  31. {

  32. int rowHandle = this.gridView采样标本接收.FocusedRowHandle;

  33. if (rowHandle >= 0)

  34. {

  35. DataRow row = this.gridView采样标本接收.GetDataRow(rowHandle);

  36. try

  37. {

  38. Clipboard.SetText(row[TableField.T_LIS_SAMPLERECEIVE_REPORTS.MEDICALRECORDNO] == null ? "" : row[TableField.T_LIS_SAMPLERECEIVE_REPORTS.MEDICALRECORDNO].ToString());

  39. }

  40. catch (Exception)

  41. {

  42. //throw;

  43. }

  44. }

  45. }

  46.  
  47. private void 复制姓名ToolStripMenuItem_Click(object sender, EventArgs e)

  48. {

  49. int rowHandle = this.gridView采样标本接收.FocusedRowHandle;

  50. if (rowHandle >= 0)

  51. {

  52. DataRow row = this.gridView采样标本接收.GetDataRow(rowHandle);

  53. try

  54. {

  55. Clipboard.SetText(row[TableField.T_LIS_SAMPLERECEIVE_REPORTS.PNAME] == null ? "" : row[TableField.T_LIS_SAMPLERECEIVE_REPORTS.PNAME].ToString());

  56. }

  57. catch (Exception)

  58. {

  59. //throw;

  60. }

  61. }

  62. }

  63.  
  64. private void 复制条码号ToolStripMenuItem_Click(object sender, EventArgs e)

  65. {

  66. int rowHandle = this.gridView采样标本接收.FocusedRowHandle;

  67. if (rowHandle >= 0)

  68. {

  69. DataRow row = this.gridView采样标本接收.GetDataRow(rowHandle);

  70. try

  71. {

  72. Clipboard.SetText(row[TableField.T_LIS_SAMPLERECEIVE_REPORTS.REQUESTRECORDNO] == null ? "" : row[TableField.T_LIS_SAMPLERECEIVE_REPORTS.REQUESTRECORDNO].ToString());

  73. }

  74. catch (Exception)

  75. {

  76. //throw;

  77. }

  78. }

  79. }

  80. #endregion

猜你喜欢

转载自blog.csdn.net/cxu123321/article/details/93464868