using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using Mesnac.Action.Base; using Mesnac.Controls.Base; using Mesnac.Controls.Default; using System.Windows.Forms; using Mesnac.Codd.Session; namespace Mesnac.Action.Feeding.Qingquan.Technology { public class ReadOnlyRecipe : FeedingAction, IAction { public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须调用 foreach (IBaseControl control in base.GetAllMCControls()) { if (control.DbOptionType==DbOptionTypes.Modify && !String.IsNullOrEmpty(control.MCKey) && !control.MCKey.ToLower().Contains(".[objid]")) { control.MCEnabled = false; } } List gridList = GetTControls(); foreach (MCDataGridView grid in gridList) { grid.ReadOnly = true; if (grid.ContextMenuStrip != null) { grid.ContextMenuStrip.Enabled = false; } } } } }