DKDataGridView.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:DKDataGridView.cs
  5. * 2.功能描述:扩展的网格控件:便于修改背景颜色及字体、颜色
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2014/08/13 1.00 新建
  9. *******************************************************************************/
  10. using System.Collections.Generic;
  11. using System.Windows.Forms;
  12. namespace Dongke.IBOSS.PRD.Basics.BaseControls
  13. {
  14. /// <summary>
  15. /// 扩展的网格控件
  16. /// </summary>
  17. public abstract partial class DKDataGridView : DataGridView, IDKControl
  18. {
  19. #region 成员变量
  20. // 异步处理开始时,控件状态
  21. private bool _beginAsyncStatus;
  22. //private Dictionary<DataGridViewColumn, bool> _beginAsyncColumnStatus;
  23. #endregion
  24. #region 控件构造函数
  25. public DKDataGridView()
  26. {
  27. InitializeComponent();
  28. this.Font = ControlsConst.FONT_SYSTEM_DEFAULT;
  29. }
  30. #endregion
  31. #region 控件属性
  32. #endregion
  33. #region 公有方法
  34. /// <summary>
  35. /// 异步处理开始
  36. /// </summary>
  37. public void BeginAsync()
  38. {
  39. //if (_beginAsyncColumnStatus == null)
  40. //{
  41. // _beginAsyncColumnStatus = new Dictionary<DataGridViewColumn, bool>();
  42. //}
  43. //if (_beginAsyncColumnStatus.Count > 0)
  44. //{
  45. // return;
  46. //}
  47. //foreach (DataGridViewColumn item in this.Columns)
  48. //{
  49. // _beginAsyncColumnStatus.Add(item, item.ReadOnly);
  50. // item.ReadOnly = true;
  51. //}
  52. //this._beginAsyncStatus = this.ReadOnly;
  53. //this.ReadOnly = true;
  54. this._beginAsyncStatus = this.Enabled;
  55. this.Enabled = false;
  56. }
  57. /// <summary>
  58. /// 异步处理结束
  59. /// </summary>
  60. public void EndAsync()
  61. {
  62. //this.ReadOnly = this._beginAsyncStatus;
  63. //foreach (DataGridViewColumn item in _beginAsyncColumnStatus.Keys)
  64. //{
  65. // item.ReadOnly = _beginAsyncColumnStatus[item];
  66. //}
  67. //_beginAsyncColumnStatus.Clear();
  68. this.Enabled = this._beginAsyncStatus;
  69. }
  70. #endregion
  71. }
  72. }