public void SetCommandVisibleState(ToolBarCommand cmd, string layName, bool visible) { if (cmd == null) { throw new ArgumentNullException(); } if (!m_commandMstates.Contains(cmd)) { throw new ArgumentException(); } LayStates layStates = (LayStates)m_commandMstates[cmd]; layStates.SetLayVisible(layName, visible); cmd.IsVisible = layStates.Visible; }
public void AddCommand(ToolBarCommand cmd, string[] lays) { if (cmd == null) { throw new ArgumentNullException(); } LayStates layStates = new LayStates(); if (lays != null) { foreach (string lay in lays) { layStates.AddLay(lay, true); } } m_commandMstates.Add(cmd, layStates); }
public static ToolStripButton BuildToolStripButton(ToolBarCommand cmd) { ToolStripButton btn = new ToolStripButton(); btn.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; btn.ImageTransparentColor = System.Drawing.Color.Magenta; btn.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; btn.TextAlign = System.Drawing.ContentAlignment.BottomCenter; btn.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; btn.Text = cmd.CommandName; btn.Visible = cmd.IsVisible; btn.Enabled = cmd.IsEnable; btn.Tag = cmd; btn.Image = DMSImageManager.GetImage("ToolButton_" + cmd.Type.ToString()); return(btn); }