public IToolBarButton Add(string id, Image image)
        {
            ToolStripButton toolStripButton = new ToolStripButton(image);

            m_toolStrip.Items.Add(toolStripButton);
            ToolBarButtonBridge toolBarButton = new ToolBarButtonBridge(toolStripButton, m_mapPanel, false);

            m_toolBarButtons.Add(toolBarButton);
            return(toolBarButton);
        }
        public void Remove(IToolBarButton toolBarButton)
        {
            ToolBarButtonBridge toolBarButtonBridge = (ToolBarButtonBridge)toolBarButton;

            if (!m_toolBarButtons.Contains(toolBarButtonBridge))
            {
                throw new Exception(
                          "Cannot remove a toolbar button that is not contained in this toolbar");
            }

            if (toolBarButton.ReadOnly)
            {
                throw new Exception("Cannot remove a built-in toolbar");
            }

            ToolStripButton toolStripButton = toolBarButtonBridge.ToolStripButton;

            toolStripButton.Owner.Items.Remove(toolStripButton);

            m_toolBarButtons.Remove(toolBarButtonBridge);
        }
Example #3
0
 public IToolBarButton Add(string id, Image image)
 {
     ToolStripButton toolStripButton = new ToolStripButton(image);
     m_toolStrip.Items.Add(toolStripButton);
     ToolBarButtonBridge toolBarButton = new ToolBarButtonBridge(toolStripButton, false);
     m_toolBarButtons.Add(toolBarButton);
     return toolBarButton;
 }