コード例 #1
0
        private void updateEnablement(ToolStripItemCollection items)
        {
            foreach (ToolStripItem item in items)
            {
                if (item != null)
                {
                    StripCommand cmd = item.Tag as StripCommand;
                    if (cmd != null)
                    {
                        item.Enabled = cmd.CanExecute();

                        ToolStripButton button = item as ToolStripButton;
                        if (button != null)
                        {
                            button.Checked = cmd.HasExecuted();
                        }

                        ToolStripMenuItem menu = item as ToolStripMenuItem;
                        if (menu != null)
                        {
                            menu.Checked = cmd.HasExecuted();
                        }
                    }
                }
            }
        }
コード例 #2
0
 private void setupMenu(ToolStripMenuItem tsMenu, string caption, string tip, Image image, StripCommand command)
 {
     tsMenu.Text        = caption;
     tsMenu.Image       = image;
     tsMenu.Tag         = command;
     tsMenu.ToolTipText = tip;
     tsMenu.Click      += toolItemClick;
 }
コード例 #3
0
 private void setupItem(ToolStripItem tsItem, string caption, string tip, Image image, StripCommand command)
 {
     tsItem.Text        = caption;
     tsItem.Image       = image;
     tsItem.Tag         = command;
     tsItem.ToolTipText = tip;
     tsItem.Click      += toolItemClick;
 }
コード例 #4
0
 private void setupButtonAndMenu(ToolStripButton tsButton, ToolStripMenuItem tsMenu, string caption, string tip,
                                 Image image, StripCommand command)
 {
     setupItem(tsButton, caption, tip, image, command);
     setupMenu(tsMenu, caption, tip, image, command);
 }
コード例 #5
0
ファイル: CommandButton.cs プロジェクト: dlech/NXTCamView
 public CommandButton(StripCommand command)
 {
     _command = command;
 }