CS开发框架禁用主窗体Toolbar的按钮
作者:C/S原创  发布日期:2011-04-14 20:27:17
CS开发框架禁用主窗体Toolbar的按钮

重写frmBaseDataForm窗体的ButtonStateChanged方法即可,参考下面的代码:


protected override void ButtonStateChanged(UpdateType currentState)
{
   base.ButtonStateChanged(currentState);

   //新增或修改状态
   bool accessable = currentState == UpdateType.Add || currentState == UpdateType.Modify;

   //跟据状态禁用输入框
   base.SetDetailEditorsAccessable(gcDetailEditor, accessable);
   
   //禁用数据操作按钮
   _buttons.GetButtonByName("btnView").Enable = false;
   _buttons.GetButtonByName("btnAdd").Enable = false;
   _buttons.GetButtonByName("btnDelete").Enable = false;
   _buttons.GetButtonByName("btnPrint").Enable = false;
   _buttons.GetButtonByName("btnPreview").Enable = false;
}

// 来源:www.CSFramework.com, C/S框架网


上一篇 下一篇