| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:DKToolStrip.cs
- * 2.功能描述:扩展的工具栏控件:便于修改背景颜色及字体、颜色
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2014/08/13 1.00 新建
- *******************************************************************************/
- using System.Collections.Generic;
- using System.Windows.Forms;
- namespace Dongke.IBOSS.PRD.Basics.BaseControls
- {
- /// <summary>
- /// 扩展的工具栏控件
- /// </summary>
- public abstract partial class DKToolStrip : ToolStrip, IDKControl
- {
- #region 成员变量
- // 异步处理开始时,控件状态
- private Dictionary<ToolStripItem, bool> _beginAsyncStatus;
- #endregion
- #region 控件构造函数
- public DKToolStrip()
- {
- InitializeComponent();
- this.Font = ControlsConst.FONT_SYSTEM_DEFAULT;
- }
- #endregion
- #region 控件属性
- #endregion
- #region 公有方法
- /// <summary>
- /// 异步处理开始
- /// </summary>
- public void BeginAsync()
- {
- if (_beginAsyncStatus == null)
- {
- _beginAsyncStatus = new Dictionary<ToolStripItem, bool>();
- }
- foreach (ToolStripItem item in this.Items)
- {
- if (item is ToolStripSeparator
- || item is ToolStripLabel
- || item is ToolStripProgressBar
- )
- {
- }
- else if (item is ToolStripTextBox)
- {
- ToolStripTextBox tst = (item as ToolStripTextBox);
- _beginAsyncStatus.Add(tst, tst.ReadOnly);
- tst.ReadOnly = true;
- }
- else
- {
- _beginAsyncStatus.Add(item, item.Enabled);
- item.Enabled = false;
- }
- }
- }
- /// <summary>
- /// 异步处理结束
- /// </summary>
- public void EndAsync()
- {
- foreach (ToolStripItem item in _beginAsyncStatus.Keys)
- {
- if (item is ToolStripSeparator
- || item is ToolStripLabel
- || item is ToolStripProgressBar
- )
- {
- }
- else if (item is ToolStripTextBox)
- {
- ToolStripTextBox tst = (item as ToolStripTextBox);
- tst.ReadOnly = _beginAsyncStatus[item];
- }
- else
- {
- item.Enabled = _beginAsyncStatus[item];
- }
- }
- _beginAsyncStatus.Clear();
- }
- #endregion
- }
- }
|