Ejemplo n.º 1
0
        private Crownwood.Magic.Menus.MenuControl CreateMenus()
        {
            Crownwood.Magic.Menus.MenuControl topMenu = new Crownwood.Magic.Menus.MenuControl();

            #region Tools menu

            MenuCommand toolItem = new MenuCommand("Tools");

            topMenu.MenuCommands.AddRange(new MenuCommand[] { toolItem });

            MenuHandler menuHandler = new MenuHandler();
            MenuEntity  menuEntity  = menuHandler.LoadMenu();

            foreach (MenuEntity childEntity in menuEntity.Children)
            {
                menuHandler.DisplayMenu(tabControl, toolItem, childEntity);
            }
            #endregion

            MenuCommand configItem      = new MenuCommand("Configs");
            MenuCommand connectionsItem = new MenuCommand("Connections...");
            connectionsItem.Click += new EventHandler(DoConnectionsItemClick);
            configItem.MenuCommands.Add(connectionsItem);
            topMenu.MenuCommands.Add(configItem);

            return(topMenu);
        }
Ejemplo n.º 2
0
        void CreateMainMenu()
        {
            this.SuspendLayout();
            topMenu = new MenuControl();
            //添加用户菜单
            Crownwood.Magic.Menus.MenuCommand itemUserManage = new MenuCommand("用户管理");
            Crownwood.Magic.Menus.MenuCommand itemAddUser    = new MenuCommand("添加新用户", new EventHandler(AddUser));
            Crownwood.Magic.Menus.MenuCommand itemModifyUserNameAndProperty = new MenuCommand("更新用户权限", new EventHandler(ModifyUserProperty));
            Crownwood.Magic.Menus.MenuCommand itemModifyUserName            = new MenuCommand("用户更改姓名", new EventHandler(ModifyUserName));
            Crownwood.Magic.Menus.MenuCommand itemModifyUserPassword        = new MenuCommand("用户更改密码", new EventHandler(ModifyUserPassword));
            Crownwood.Magic.Menus.MenuCommand itemDeleteUser = new MenuCommand("删除用户", new EventHandler(DeleteUser));
            Crownwood.Magic.Menus.MenuCommand itemUserExit   = new MenuCommand("用户退出", new EventHandler(UserExit));

            itemUserManage.MenuCommands.AddRange(new MenuCommand[] { itemAddUser, itemModifyUserNameAndProperty, itemModifyUserName, itemModifyUserPassword, itemDeleteUser, itemUserExit });
            //添加业务员管理菜单
            Crownwood.Magic.Menus.MenuCommand itemEmployeeManage = new MenuCommand("业务员管理");
            Crownwood.Magic.Menus.MenuCommand itemAddEmployee    = new MenuCommand("添加业务员", new EventHandler(AddEmployee));
            Crownwood.Magic.Menus.MenuCommand itemModifyEmployee = new MenuCommand("更新业务员", new EventHandler(ModifyEmployee));
            Crownwood.Magic.Menus.MenuCommand itemDeleteEmployee = new MenuCommand("删除业务员", new EventHandler(DeleteEmployee));

            itemEmployeeManage.MenuCommands.AddRange(new MenuCommand[] { itemAddEmployee, itemModifyEmployee, itemDeleteEmployee });

            //添加订阅系统菜单
            Crownwood.Magic.Menus.MenuCommand itemSubscribeManage      = new MenuCommand("订阅管理");
            Crownwood.Magic.Menus.MenuCommand itemAddSubscribe         = new MenuCommand("添加订阅", new EventHandler(AddSubscribe));
            Crownwood.Magic.Menus.MenuCommand itemBatchModifySubscribe = new MenuCommand("批量修改", new EventHandler(BatchModifySubscribe));

            Crownwood.Magic.Menus.MenuCommand itemModifySubscribe = new MenuCommand("修改订阅", new EventHandler(ModifySubscribe));
            Crownwood.Magic.Menus.MenuCommand itemDeleteSubscribe = new MenuCommand("删除订阅", new EventHandler(DeleteSubscribe));
            Crownwood.Magic.Menus.MenuCommand itemSearchSubscribe = new MenuCommand("查询订阅", new EventHandler(SearchSubscribe));
            Crownwood.Magic.Menus.MenuCommand itemOtherSearch     = new MenuCommand("其它查询", new EventHandler(OtherSearch));
            Crownwood.Magic.Menus.MenuCommand itemInputSubscribe  = new MenuCommand("数据导入", new EventHandler(InputSubscribe));
            Crownwood.Magic.Menus.MenuCommand itemOutputSubscribe = new MenuCommand("数据导出", new EventHandler(OutputSubscribe));
            Crownwood.Magic.Menus.MenuCommand itemStatSubscribe   = new MenuCommand("统计金额", new EventHandler(StatSubscribe));

            itemSubscribeManage.MenuCommands.AddRange(new MenuCommand[] { itemAddSubscribe, itemModifySubscribe, itemBatchModifySubscribe, itemDeleteSubscribe, itemSearchSubscribe, itemOtherSearch, itemInputSubscribe, itemOutputSubscribe, itemStatSubscribe });

            //添加其他菜单
            Crownwood.Magic.Menus.MenuCommand itemOtherInfoManage = new MenuCommand("其它管理");
            Crownwood.Magic.Menus.MenuCommand itemAddRegion       = new MenuCommand("添加地区", new EventHandler(AddRegion));
            Crownwood.Magic.Menus.MenuCommand itemDeleteRegion    = new MenuCommand("删除地区", new EventHandler(DeleteRegion));

            itemOtherInfoManage.MenuCommands.AddRange(new MenuCommand[] { itemAddRegion, itemDeleteRegion });


            topMenu.MenuCommands.AddRange(new MenuCommand[] { itemUserManage, itemEmployeeManage, itemSubscribeManage, itemOtherInfoManage });
            topMenu.Dock = DockStyle.Top;

            this.Controls.Add(topMenu);
            this.ResumeLayout();
            this.Menu            = null;
            topMenu.Style        = Crownwood.Magic.Common.VisualStyle.IDE;
            topMenu.MdiContainer = this;
        }
Ejemplo n.º 3
0
        private void InitDockingWindows()
        {
            dockingManager = new DockingManager(this, VisualStyle.IDE);

            //Add the tab control first.
            tabControl = new Crownwood.Magic.Controls.TabControl();
            Panel welcomePanel  = new Panel();
            Panel welcomePanel2 = new Panel();

            welcomePanel.Dock = DockStyle.Fill;

            Crownwood.Magic.Controls.TabPage welcomePage = new Crownwood.Magic.Controls.TabPage("Welcome", welcomePanel);
            tabControl.TabPages.Add(welcomePage);
            tabControl.Appearance    = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiDocument;
            tabControl.Dock          = DockStyle.Fill;
            tabControl.ClosePressed += new EventHandler(DoTabControlClosePressed);
            Controls.Add(tabControl);

            //Add Message form
            messageForm = new MessagesForm();
            Content       messageContent       = dockingManager.Contents.Add(messageForm, "System Messages");
            WindowContent messageWindowContent = dockingManager.AddContentWithState(messageContent, State.DockBottom) as WindowContent;

            //Add Menus
            topMenu = CreateMenus();
            Controls.Add(topMenu);

            //Add status bar
            statusBar            = new StatusBar();
            statusBar.Dock       = DockStyle.Bottom;
            statusBar.ShowPanels = true;

            StatusBarPanel statusBarPanel = new StatusBarPanel();

            statusBarPanel.AutoSize = StatusBarPanelAutoSize.Spring;
            statusBar.Panels.Add(statusBarPanel);
            Controls.Add(statusBar);

            dockingManager.InnerControl = tabControl;
            dockingManager.OuterControl = statusBar;
        }
Ejemplo n.º 4
0
        protected void SetupMenus()
        {
            // Create the MenuControl
            _topMenu = new Crownwood.Magic.Menus.MenuControl();

            // We want the control to handle the MDI pendant
            _topMenu.MdiContainer = this;

            // Create the top level Menu
            MenuCommand top1 = new MenuCommand("&Appearance");
            MenuCommand top2 = new MenuCommand("&Windows");
            MenuCommand top3 = new MenuCommand("A&nimation");
            MenuCommand top4 = new MenuCommand("&Cities1");
            MenuCommand top5 = new MenuCommand("&Movies1");
            MenuCommand top6 = new MenuCommand("Ca&rs1");
            MenuCommand top7 = new MenuCommand("C&ities2");
            MenuCommand top8 = new MenuCommand("Mo&vies2");
            MenuCommand top9 = new MenuCommand("Car&s2");

            _topMenu.MenuCommands.AddRange(new MenuCommand[] { top1, top2, top3, top4, top5, top6, top7, top8, top9 });

            // Create the submenus
            CreateAppearanceMenu(top1);
            CreateWindowsMenu(top2);
            CreateAnimationMenu(top3);
            CreateCityMenus(top4, top7);
            CreateMovieMenus(top5, top8);
            CreateCarMenus(top6, top9);

            // Add to the display
            _topMenu.Dock        = DockStyle.Top;
            _topMenu.Selected   += new CommandHandler(OnSelected);
            _topMenu.Deselected += new CommandHandler(OnDeselected);
            Controls.Add(_topMenu);

            // Create an initial MDI child window
            OnNewWindowSelected(null, EventArgs.Empty);
        }
Ejemplo n.º 5
0
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.MainTabs = new Crownwood.Magic.Controls.TabControl();
            this.GameTab = new Crownwood.Magic.Controls.TabPage();
            this.RenderTarget = new System.Windows.Forms.Panel();
            this.MainMenu = new Crownwood.Magic.Menus.MenuControl();
            this.FileMenu = new Crownwood.Magic.Menus.MenuCommand();
            this.FileSave = new Crownwood.Magic.Menus.MenuCommand();
            this.FileQuit = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewMenu = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewLog = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewConnect = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewWhoList = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewSkillList = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewChat = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewCommand = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewFirstPerson = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewChaseCam = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewMiniMap = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewOptions = new Crownwood.Magic.Menus.MenuCommand();
            this.ViewAdmin = new Crownwood.Magic.Menus.MenuCommand();
            this.MainStatus = new System.Windows.Forms.StatusBar();
            this.AreaInformation = new System.Windows.Forms.StatusBarPanel();
            this.Information = new System.Windows.Forms.StatusBarPanel();
            this.Coords = new System.Windows.Forms.StatusBarPanel();
            this.GameTab.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.AreaInformation)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.Information)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.Coords)).BeginInit();
            this.SuspendLayout();
            // 
            // MainTabs
            // 
            this.MainTabs.Dock = System.Windows.Forms.DockStyle.Fill;
            this.MainTabs.Location = new System.Drawing.Point(2, 27);
            this.MainTabs.Name = "MainTabs";
            this.MainTabs.SelectedIndex = 0;
            this.MainTabs.SelectedTab = this.GameTab;
            this.MainTabs.Size = new System.Drawing.Size(888, 715);
            this.MainTabs.TabIndex = 0;
            this.MainTabs.TabPages.AddRange(new Crownwood.Magic.Controls.TabPage[] {
            this.GameTab});
            // 
            // GameTab
            // 
            this.GameTab.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.GameTab.Controls.Add(this.RenderTarget);
            this.GameTab.Location = new System.Drawing.Point(0, 0);
            this.GameTab.Name = "GameTab";
            this.GameTab.Size = new System.Drawing.Size(888, 690);
            this.GameTab.TabIndex = 0;
            this.GameTab.Title = "Game";
            // 
            // RenderTarget
            // 
            this.RenderTarget.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.RenderTarget.Location = new System.Drawing.Point(0, 0);
            this.RenderTarget.Name = "RenderTarget";
            this.RenderTarget.Size = new System.Drawing.Size(782, 427);
            this.RenderTarget.TabIndex = 1;
            // 
            // MainMenu
            // 
            this.MainMenu.AnimateStyle = Crownwood.Magic.Menus.Animation.System;
            this.MainMenu.AnimateTime = 100;
            this.MainMenu.Cursor = System.Windows.Forms.Cursors.Arrow;
            this.MainMenu.Direction = Crownwood.Magic.Common.Direction.Horizontal;
            this.MainMenu.Dock = System.Windows.Forms.DockStyle.Top;
            this.MainMenu.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
            this.MainMenu.HighlightTextColor = System.Drawing.SystemColors.MenuText;
            this.MainMenu.Location = new System.Drawing.Point(2, 2);
            this.MainMenu.MenuCommands.AddRange(new Crownwood.Magic.Menus.MenuCommand[] {
            this.FileMenu,
            this.ViewMenu});
            this.MainMenu.Name = "MainMenu";
            this.MainMenu.Size = new System.Drawing.Size(888, 25);
            this.MainMenu.Style = Crownwood.Magic.Common.VisualStyle.IDE;
            this.MainMenu.TabIndex = 0;
            this.MainMenu.TabStop = false;
            // 
            // FileMenu
            // 
            this.FileMenu.Description = "The File menu";
            this.FileMenu.MenuCommands.AddRange(new Crownwood.Magic.Menus.MenuCommand[] {
            this.FileSave,
            this.FileQuit});
            this.FileMenu.Text = "&File";
            // 
            // FileSave
            // 
            this.FileSave.Description = "MenuItem";
            this.FileSave.Text = "Save";
            this.FileSave.Click += new System.EventHandler(this.FileSave_Click);
            // 
            // FileQuit
            // 
            this.FileQuit.Description = "MenuItem";
            this.FileQuit.Text = "Quit";
            this.FileQuit.Click += new System.EventHandler(this.FileQuit_Click);
            // 
            // ViewMenu
            // 
            this.ViewMenu.Description = "MenuItem";
            this.ViewMenu.MenuCommands.AddRange(new Crownwood.Magic.Menus.MenuCommand[] {
            this.ViewLog,
            this.ViewConnect,
            this.ViewWhoList,
            this.ViewSkillList,
            this.ViewChat,
            this.ViewCommand,
            this.ViewFirstPerson,
            this.ViewChaseCam,
            this.ViewMiniMap,
            this.ViewOptions,
            this.ViewAdmin});
            this.ViewMenu.Text = "&View";
            // 
            // ViewLog
            // 
            this.ViewLog.Description = "MenuItem";
            this.ViewLog.Text = "Log";
            this.ViewLog.Click += new System.EventHandler(this.ViewLog_Click);
            // 
            // ViewConnect
            // 
            this.ViewConnect.Description = "MenuItem";
            this.ViewConnect.Text = "Connect";
            this.ViewConnect.Click += new System.EventHandler(this.ViewConnect_Click);
            // 
            // ViewWhoList
            // 
            this.ViewWhoList.Description = "MenuItem";
            this.ViewWhoList.Text = "Who";
            this.ViewWhoList.Click += new System.EventHandler(this.ViewWhoList_Click);
            // 
            // ViewSkillList
            // 
            this.ViewSkillList.Description = "MenuItem";
            this.ViewSkillList.Text = "Skills";
            this.ViewSkillList.Click += new System.EventHandler(this.ViewSkillList_Click);
            // 
            // ViewChat
            // 
            this.ViewChat.Description = "View Chat";
            this.ViewChat.Text = "Chat";
            this.ViewChat.Click += new System.EventHandler(this.ViewChat_Click);
            // 
            // ViewCommand
            // 
            this.ViewCommand.Description = "View Command";
            this.ViewCommand.Text = "Command";
            this.ViewCommand.Click += new System.EventHandler(this.ViewCommand_Click);
            // 
            // ViewFirstPerson
            // 
            this.ViewFirstPerson.Description = "First Person Mode";
            this.ViewFirstPerson.Text = "First Person Mode";
            this.ViewFirstPerson.Click += new System.EventHandler(this.ViewFirstPerson_Click);
            // 
            // ViewChaseCam
            // 
            this.ViewChaseCam.Description = "Chase Camera";
            this.ViewChaseCam.Text = "Chase Camera";
            this.ViewChaseCam.Click += new System.EventHandler(this.ViewChaseCam_Click);
            // 
            // ViewMiniMap
            // 
            this.ViewMiniMap.Description = "MenuItem";
            this.ViewMiniMap.Text = "Mini Map";
            this.ViewMiniMap.Click += new System.EventHandler(this.ViewMiniMap_Click);
            // 
            // ViewOptions
            // 
            this.ViewOptions.Description = "Options";
            this.ViewOptions.Text = "Options";
            this.ViewOptions.Click += new System.EventHandler(this.ViewOptions_Click);
            // 
            // ViewAdmin
            // 
            this.ViewAdmin.Description = "ViewAdmin";
            this.ViewAdmin.Text = "ViewAdmin";
            this.ViewAdmin.Click += new System.EventHandler(this.ViewAdmin_Click);
            // 
            // MainStatus
            // 
            this.MainStatus.Location = new System.Drawing.Point(2, 742);
            this.MainStatus.Name = "MainStatus";
            this.MainStatus.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
            this.AreaInformation,
            this.Information,
            this.Coords});
            this.MainStatus.ShowPanels = true;
            this.MainStatus.Size = new System.Drawing.Size(888, 40);
            this.MainStatus.TabIndex = 1;
            // 
            // AreaInformation
            // 
            this.AreaInformation.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
            this.AreaInformation.Name = "AreaInformation";
            this.AreaInformation.Width = 10;
            // 
            // Information
            // 
            this.Information.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
            this.Information.Name = "Information";
            this.Information.Text = "statusBarPanel1";
            this.Information.Width = 851;
            // 
            // Coords
            // 
            this.Coords.Alignment = System.Windows.Forms.HorizontalAlignment.Right;
            this.Coords.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
            this.Coords.Name = "Coords";
            this.Coords.Width = 10;
            // 
            // Main
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 16);
            this.ClientSize = new System.Drawing.Size(892, 784);
            this.Controls.Add(this.MainTabs);
            this.Controls.Add(this.MainMenu);
            this.Controls.Add(this.MainStatus);
            this.Name = "Main";
            this.Padding = new System.Windows.Forms.Padding(2);
            this.Text = "";
            this.Closing += new System.ComponentModel.CancelEventHandler(this.Main_Closing);
            this.Load += new System.EventHandler(this.Load_Form);
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Main_KeyDown);
            this.GameTab.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.AreaInformation)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.Information)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.Coords)).EndInit();
            this.ResumeLayout(false);

		}
Ejemplo n.º 6
0
    public MediaPortalEditor()
    {
      InitializeComponent();
      Text = "MediaPortalEditor";

      // Initialize style options
      style = VisualStyle.IDE;
      SetStyle(ControlStyles.DoubleBuffer, true);
      SetStyle(ControlStyles.AllPaintingInWmPaint, true);

      // Create the docking and tab manager
      tabManager = new TabControl();
      tabManager.Appearance = TabControl.VisualAppearance.MultiDocument;
      tabManager.ClosePressed += new EventHandler(OnDesignerClosed);
      tabManager.SelectionChanged += new EventHandler(OnDesignerIndexChanged);
      tabManager.Dock = DockStyle.Fill;
      tabManager.Style = style;
      tabManager.IDEPixelBorder = true;
      tabManager.ShowClose = false;
      tabManager.ImageList = tabImageList;
      Controls.Add(tabManager);

      dockManager = new DockingManager(this, style);
      dockManager.InnerControl = tabManager;
      dockManager.TabControlCreated += new DockingManager.TabControlCreatedHandler(OnTabControlCreated);
      dockManager.ContentHidden += new DockingManager.ContentHandler(OnContentHidden);
      dockManager.ContentShown += new DockingManager.ContentHandler(OnContentShown);

      // Create Status Bar
      statusBar = CreateStatusBar();
      dockManager.OuterControl = statusBar;

      // Create Menu and Toolbar
      topMenu = CreateTopMenu();

      // Create Skin Tree
      skinExplorer = new MpeExplorer(this);
      Content c = dockManager.Contents.Add(skinExplorer, "Explorer", serviceImageList, 0);
      dockManager.AddContentWithState(c, State.DockLeft);

      // Create Properties
      propertyManager = new MpePropertyManager(this);
      c = dockManager.Contents.Add(propertyManager, "Properties", serviceImageList, 1);
      dockManager.AddContentWithState(c, State.DockRight);

      // Create Help Manager and Browser
      helpManager = new MpeHelpManager(this);
      c = dockManager.Contents.Add(helpManager, "Help", serviceImageList, 2);
      dockManager.AddContentWithState(c, State.DockBottom);
      helpBrowser = new MpeHelpBrowser(this);

      // Setup Tab Designers
      selectedDesignerIndex = -1;

      // Static Self Reference
      self = this;
    }
Ejemplo n.º 7
0
    protected MenuControl CreateTopMenu()
    {
      MenuControl menu = new MenuControl();
      menu.Style = style;
      menu.MultiLine = false;

      fileMenu = new MenuCommand("&File");
      editMenu = new MenuCommand("&Edit");
      helpMenu = new MenuCommand("&Help");
      viewMenu = new MenuCommand("&View");
      menu.MenuCommands.AddRange(new MenuCommand[] {fileMenu, editMenu, viewMenu, helpMenu});
      // File
      MenuCommand newMenu = new MenuCommand("&New...", Shortcut.CtrlN, new EventHandler(OnMenuNew));
      MenuCommand openMenu = new MenuCommand("&Open...", menuImageList, 0, Shortcut.CtrlO, new EventHandler(OnMenuOpen));
      MenuCommand closeMenu = new MenuCommand("&Close", new EventHandler(OnMenuClose));
      closeMenu.Enabled = false;
      MenuCommand exitMenu = new MenuCommand("E&xit", new EventHandler(OnMenuExit));
      MenuCommand saveMenu = new MenuCommand("&Save", menuImageList, 1, Shortcut.CtrlS, new EventHandler(OnMenuSave));
      saveMenu.Enabled = false;
      MenuCommand saveAllMenu =
        new MenuCommand("Save A&ll", menuImageList, 2, Shortcut.CtrlShiftS, new EventHandler(OnMenuSaveAll));
      saveAllMenu.Enabled = false;
      fileMenu.MenuCommands.AddRange(
        new MenuCommand[]
          {
            newMenu, openMenu, new MenuCommand("-"), saveMenu, saveAllMenu, new MenuCommand("-"), closeMenu,
            new MenuCommand("-"), exitMenu
          });

      // Edit
      MenuCommand cutMenu = new MenuCommand("Cu&t", Shortcut.CtrlX, new EventHandler(OnMenuCut));
      MenuCommand copyMenu = new MenuCommand("&Copy", Shortcut.CtrlC, new EventHandler(OnMenuCopy));
      MenuCommand pasteMenu = new MenuCommand("&Paste", Shortcut.CtrlV, new EventHandler(OnMenuPaste));
      MenuCommand preferencesMenu = new MenuCommand("&Preferences", new EventHandler(OnMenuPreferences));
      editMenu.MenuCommands.AddRange(
        new MenuCommand[] {cutMenu, copyMenu, pasteMenu, new MenuCommand("-"), preferencesMenu});

      // View
      MenuCommand skinExplorerMenu =
        new MenuCommand("&Explorer", menuImageList, 4, Shortcut.F3, new EventHandler(OnMenuView));
      skinExplorerMenu.Tag = "Explorer";
      MenuCommand propertiesMenu =
        new MenuCommand("&Properties", menuImageList, 3, Shortcut.F4, new EventHandler(OnMenuView));
      propertiesMenu.Tag = "Properties";
      viewMenu.MenuCommands.AddRange(new MenuCommand[] {skinExplorerMenu, propertiesMenu});

      // Help
      MenuCommand aboutMenu = new MenuCommand("&About", new EventHandler(OnMenuAbout));
      MenuCommand helpCommand = new MenuCommand("&Help", menuImageList, 5, new EventHandler(OnMenuView));
      helpCommand.Tag = "Help";
      helpMenu.MenuCommands.AddRange(new MenuCommand[] {helpCommand, new MenuCommand("-"), aboutMenu});

      menu.Dock = DockStyle.Top;
      Controls.Add(menu);

      return menu;
    }
Ejemplo n.º 8
0
    public SampleDocking()
    {
        // Discover which docking manager to use
        if (DialogResult.Yes == MessageBox.Show("Press 'Yes' to select IDE appearance\n\n" +
                                                "Press 'No' to select Plain appearance\n",
                                                "Select Visual Style", MessageBoxButtons.YesNo))
        {
            _style = VisualStyle.IDE;
        }
        else
        {
            _style = VisualStyle.Plain;
        }

        InitializeComponent();

        // Create a strip of images by loading an embedded bitmap resource
        _internalImages = ResourceHelper.LoadBitmapStrip(this.GetType(),
                                                         "SampleDocking.SampleImages.bmp",
                                                         new Size(16, 16),
                                                         new Point(0, 0));

        BorderStyle bs = (_style == VisualStyle.Plain) ? BorderStyle.None : BorderStyle.FixedSingle;

        RichTextBox rtb1 = new RichTextBox();
        RichTextBox rtb2 = new RichTextBox();
        RichTextBox rtb3 = new RichTextBox();

        rtb1.BorderStyle = bs;
        rtb2.BorderStyle = bs;
        rtb3.BorderStyle = bs;

        _filler = new Crownwood.Magic.Controls.TabControl();
        _filler.TabPages.Add(new Crownwood.Magic.Controls.TabPage("First", rtb1));
        _filler.TabPages.Add(new Crownwood.Magic.Controls.TabPage("Second", rtb2));
        _filler.TabPages.Add(new Crownwood.Magic.Controls.TabPage("Third", rtb3));
        _filler.Appearance     = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiDocument;
        _filler.Dock           = DockStyle.Fill;
        _filler.Style          = _style;
        _filler.IDEPixelBorder = true;
        Controls.Add(_filler);

        // Reduce the amount of flicker that occurs when windows are redocked within
        // the container. As this prevents unsightly backcolors being drawn in the
        // WM_ERASEBACKGROUND that seems to occur.
        SetStyle(ControlStyles.DoubleBuffer, true);
        SetStyle(ControlStyles.AllPaintingInWmPaint, true);

        // Create the object that manages the docking state
        _manager = new DockingManager(this, _style);

        // Notifications
        _manager.ContextMenu       += new DockingManager.ContextMenuHandler(OnContextMenu);
        _manager.ContentHiding     += new DockingManager.ContentHidingHandler(OnContentHiding);
        _manager.TabControlCreated += new DockingManager.TabControlCreatedHandler(OnTabControlCreated);

        // Ensure that the RichTextBox is always the innermost control
        _manager.InnerControl = _filler;

        // Create and setup the StatusBar object
        _statusBar            = new StatusBar();
        _statusBar.Dock       = DockStyle.Bottom;
        _statusBar.ShowPanels = true;

        // Create and setup a single panel for the StatusBar
        StatusBarPanel statusBarPanel = new StatusBarPanel();

        statusBarPanel.AutoSize = StatusBarPanelAutoSize.Spring;
        _statusBar.Panels.Add(statusBarPanel);
        Controls.Add(_statusBar);

        _topMenu = CreateMenus();

        // Ensure that docking occurs after the menu control and status bar controls
        _manager.OuterControl = _statusBar;

        // Setup custom config handling
        _manager.SaveCustomConfig += new DockingManager.SaveCustomConfigHandler(OnSaveConfig);
        _manager.LoadCustomConfig += new DockingManager.LoadCustomConfigHandler(OnLoadConfig);
    }
Ejemplo n.º 9
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.MainTabs        = new Crownwood.Magic.Controls.TabControl();
     this.GameTab         = new Crownwood.Magic.Controls.TabPage();
     this.RenderTarget    = new System.Windows.Forms.Panel();
     this.MainMenu        = new Crownwood.Magic.Menus.MenuControl();
     this.FileMenu        = new Crownwood.Magic.Menus.MenuCommand();
     this.FileSave        = new Crownwood.Magic.Menus.MenuCommand();
     this.FileQuit        = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewMenu        = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewLog         = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewConnect     = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewWhoList     = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewSkillList   = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewChat        = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewCommand     = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewFirstPerson = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewChaseCam    = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewMiniMap     = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewOptions     = new Crownwood.Magic.Menus.MenuCommand();
     this.ViewAdmin       = new Crownwood.Magic.Menus.MenuCommand();
     this.MainStatus      = new System.Windows.Forms.StatusBar();
     this.AreaInformation = new System.Windows.Forms.StatusBarPanel();
     this.Information     = new System.Windows.Forms.StatusBarPanel();
     this.Coords          = new System.Windows.Forms.StatusBarPanel();
     this.GameTab.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.AreaInformation)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.Information)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.Coords)).BeginInit();
     this.SuspendLayout();
     //
     // MainTabs
     //
     this.MainTabs.Dock          = System.Windows.Forms.DockStyle.Fill;
     this.MainTabs.Location      = new System.Drawing.Point(2, 27);
     this.MainTabs.Name          = "MainTabs";
     this.MainTabs.SelectedIndex = 0;
     this.MainTabs.SelectedTab   = this.GameTab;
     this.MainTabs.Size          = new System.Drawing.Size(888, 715);
     this.MainTabs.TabIndex      = 0;
     this.MainTabs.TabPages.AddRange(new Crownwood.Magic.Controls.TabPage[] {
         this.GameTab
     });
     //
     // GameTab
     //
     this.GameTab.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                  | System.Windows.Forms.AnchorStyles.Left)
                                                                 | System.Windows.Forms.AnchorStyles.Right)));
     this.GameTab.Controls.Add(this.RenderTarget);
     this.GameTab.Location = new System.Drawing.Point(0, 0);
     this.GameTab.Name     = "GameTab";
     this.GameTab.Size     = new System.Drawing.Size(888, 690);
     this.GameTab.TabIndex = 0;
     this.GameTab.Title    = "Game";
     //
     // RenderTarget
     //
     this.RenderTarget.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                       | System.Windows.Forms.AnchorStyles.Left)
                                                                      | System.Windows.Forms.AnchorStyles.Right)));
     this.RenderTarget.Location = new System.Drawing.Point(0, 0);
     this.RenderTarget.Name     = "RenderTarget";
     this.RenderTarget.Size     = new System.Drawing.Size(782, 427);
     this.RenderTarget.TabIndex = 1;
     //
     // MainMenu
     //
     this.MainMenu.AnimateStyle       = Crownwood.Magic.Menus.Animation.System;
     this.MainMenu.AnimateTime        = 100;
     this.MainMenu.Cursor             = System.Windows.Forms.Cursors.Arrow;
     this.MainMenu.Direction          = Crownwood.Magic.Common.Direction.Horizontal;
     this.MainMenu.Dock               = System.Windows.Forms.DockStyle.Top;
     this.MainMenu.Font               = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
     this.MainMenu.HighlightTextColor = System.Drawing.SystemColors.MenuText;
     this.MainMenu.Location           = new System.Drawing.Point(2, 2);
     this.MainMenu.MenuCommands.AddRange(new Crownwood.Magic.Menus.MenuCommand[] {
         this.FileMenu,
         this.ViewMenu
     });
     this.MainMenu.Name     = "MainMenu";
     this.MainMenu.Size     = new System.Drawing.Size(888, 25);
     this.MainMenu.Style    = Crownwood.Magic.Common.VisualStyle.IDE;
     this.MainMenu.TabIndex = 0;
     this.MainMenu.TabStop  = false;
     //
     // FileMenu
     //
     this.FileMenu.Description = "The File menu";
     this.FileMenu.MenuCommands.AddRange(new Crownwood.Magic.Menus.MenuCommand[] {
         this.FileSave,
         this.FileQuit
     });
     this.FileMenu.Text = "&File";
     //
     // FileSave
     //
     this.FileSave.Description = "MenuItem";
     this.FileSave.Text        = "Save";
     this.FileSave.Click      += new System.EventHandler(this.FileSave_Click);
     //
     // FileQuit
     //
     this.FileQuit.Description = "MenuItem";
     this.FileQuit.Text        = "Quit";
     this.FileQuit.Click      += new System.EventHandler(this.FileQuit_Click);
     //
     // ViewMenu
     //
     this.ViewMenu.Description = "MenuItem";
     this.ViewMenu.MenuCommands.AddRange(new Crownwood.Magic.Menus.MenuCommand[] {
         this.ViewLog,
         this.ViewConnect,
         this.ViewWhoList,
         this.ViewSkillList,
         this.ViewChat,
         this.ViewCommand,
         this.ViewFirstPerson,
         this.ViewChaseCam,
         this.ViewMiniMap,
         this.ViewOptions,
         this.ViewAdmin
     });
     this.ViewMenu.Text = "&View";
     //
     // ViewLog
     //
     this.ViewLog.Description = "MenuItem";
     this.ViewLog.Text        = "Log";
     this.ViewLog.Click      += new System.EventHandler(this.ViewLog_Click);
     //
     // ViewConnect
     //
     this.ViewConnect.Description = "MenuItem";
     this.ViewConnect.Text        = "Connect";
     this.ViewConnect.Click      += new System.EventHandler(this.ViewConnect_Click);
     //
     // ViewWhoList
     //
     this.ViewWhoList.Description = "MenuItem";
     this.ViewWhoList.Text        = "Who";
     this.ViewWhoList.Click      += new System.EventHandler(this.ViewWhoList_Click);
     //
     // ViewSkillList
     //
     this.ViewSkillList.Description = "MenuItem";
     this.ViewSkillList.Text        = "Skills";
     this.ViewSkillList.Click      += new System.EventHandler(this.ViewSkillList_Click);
     //
     // ViewChat
     //
     this.ViewChat.Description = "View Chat";
     this.ViewChat.Text        = "Chat";
     this.ViewChat.Click      += new System.EventHandler(this.ViewChat_Click);
     //
     // ViewCommand
     //
     this.ViewCommand.Description = "View Command";
     this.ViewCommand.Text        = "Command";
     this.ViewCommand.Click      += new System.EventHandler(this.ViewCommand_Click);
     //
     // ViewFirstPerson
     //
     this.ViewFirstPerson.Description = "First Person Mode";
     this.ViewFirstPerson.Text        = "First Person Mode";
     this.ViewFirstPerson.Click      += new System.EventHandler(this.ViewFirstPerson_Click);
     //
     // ViewChaseCam
     //
     this.ViewChaseCam.Description = "Chase Camera";
     this.ViewChaseCam.Text        = "Chase Camera";
     this.ViewChaseCam.Click      += new System.EventHandler(this.ViewChaseCam_Click);
     //
     // ViewMiniMap
     //
     this.ViewMiniMap.Description = "MenuItem";
     this.ViewMiniMap.Text        = "Mini Map";
     this.ViewMiniMap.Click      += new System.EventHandler(this.ViewMiniMap_Click);
     //
     // ViewOptions
     //
     this.ViewOptions.Description = "Options";
     this.ViewOptions.Text        = "Options";
     this.ViewOptions.Click      += new System.EventHandler(this.ViewOptions_Click);
     //
     // ViewAdmin
     //
     this.ViewAdmin.Description = "ViewAdmin";
     this.ViewAdmin.Text        = "ViewAdmin";
     this.ViewAdmin.Click      += new System.EventHandler(this.ViewAdmin_Click);
     //
     // MainStatus
     //
     this.MainStatus.Location = new System.Drawing.Point(2, 742);
     this.MainStatus.Name     = "MainStatus";
     this.MainStatus.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
         this.AreaInformation,
         this.Information,
         this.Coords
     });
     this.MainStatus.ShowPanels = true;
     this.MainStatus.Size       = new System.Drawing.Size(888, 40);
     this.MainStatus.TabIndex   = 1;
     //
     // AreaInformation
     //
     this.AreaInformation.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
     this.AreaInformation.Name     = "AreaInformation";
     this.AreaInformation.Width    = 10;
     //
     // Information
     //
     this.Information.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
     this.Information.Name     = "Information";
     this.Information.Text     = "statusBarPanel1";
     this.Information.Width    = 851;
     //
     // Coords
     //
     this.Coords.Alignment = System.Windows.Forms.HorizontalAlignment.Right;
     this.Coords.AutoSize  = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
     this.Coords.Name      = "Coords";
     this.Coords.Width     = 10;
     //
     // Main
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(6, 16);
     this.ClientSize        = new System.Drawing.Size(892, 784);
     this.Controls.Add(this.MainTabs);
     this.Controls.Add(this.MainMenu);
     this.Controls.Add(this.MainStatus);
     this.Name     = "Main";
     this.Padding  = new System.Windows.Forms.Padding(2);
     this.Text     = "";
     this.Closing += new System.ComponentModel.CancelEventHandler(this.Main_Closing);
     this.Load    += new System.EventHandler(this.Load_Form);
     this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Main_KeyDown);
     this.GameTab.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.AreaInformation)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.Information)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.Coords)).EndInit();
     this.ResumeLayout(false);
 }
Ejemplo n.º 10
0
    protected Crownwood.Magic.Menus.MenuControl CreateMenus()
    {
        Crownwood.Magic.Menus.MenuControl topMenu = new Crownwood.Magic.Menus.MenuControl();
        topMenu.Style     = _style;
        topMenu.MultiLine = false;

        MenuCommand topManager     = new MenuCommand("Manager");
        MenuCommand topConfig      = new MenuCommand("Config");
        MenuCommand topSettings    = new MenuCommand("Settings");
        MenuCommand topColors      = new MenuCommand("Colors");
        MenuCommand topTabControls = new MenuCommand("TabControls");

        topMenu.MenuCommands.AddRange(new MenuCommand[] { topManager, topConfig, topSettings, topColors, topTabControls });

        // Manager
        MenuCommand managerC1         = new MenuCommand("Create Form", new EventHandler(OnCreateC1));
        MenuCommand managerC2         = new MenuCommand("Create Panel", new EventHandler(OnCreateC2));
        MenuCommand managerC3         = new MenuCommand("Create RichTextBox", new EventHandler(OnCreateC3));
        MenuCommand managerSep1       = new MenuCommand("-");
        MenuCommand managerC31        = new MenuCommand("Create 3 in Row", new EventHandler(OnCreateC31));
        MenuCommand managerC32        = new MenuCommand("Create 3 in Column", new EventHandler(OnCreateC32));
        MenuCommand managerC33        = new MenuCommand("Create 3 in Window", new EventHandler(OnCreateC33));
        MenuCommand managerC34        = new MenuCommand("Create 3 in Window (autohide)", new EventHandler(OnCreateC34));
        MenuCommand managerSep2       = new MenuCommand("-");
        MenuCommand managerFF         = new MenuCommand("Create 3 in Floating Form", new EventHandler(OnCreateFF));
        MenuCommand managerSep3       = new MenuCommand("-");
        MenuCommand managerClear      = new MenuCommand("Delete Contents", new EventHandler(OnDeleteAll));
        MenuCommand managerSep4       = new MenuCommand("-");
        MenuCommand managerShowAll    = new MenuCommand("Show All", new EventHandler(OnShowAll));
        MenuCommand managerHideAll    = new MenuCommand("Hide All", new EventHandler(OnHideAll));
        MenuCommand managerSep5       = new MenuCommand("-");
        MenuCommand managerInsideFill = new MenuCommand("Inside Fill", new EventHandler(OnInsideFill));
        MenuCommand managerSep6       = new MenuCommand("-");
        MenuCommand managerExit       = new MenuCommand("Exit", new EventHandler(OnExit));

        managerInsideFill.Update += new EventHandler(OnUpdateInsideFill);

        topManager.MenuCommands.AddRange(new MenuCommand[] { managerC1, managerC2, managerC3, managerSep1,
                                                             managerC31, managerC32, managerC33, managerC34, managerSep2,
                                                             managerFF, managerSep3,
                                                             managerClear, managerSep4, managerShowAll,
                                                             managerHideAll, managerSep5, managerInsideFill,
                                                             managerSep5, managerExit });

        // Config
        MenuCommand configSF1  = new MenuCommand("Save as Config1.xml", new EventHandler(OnSaveFile1));
        MenuCommand configSF2  = new MenuCommand("Save as Config2.xml", new EventHandler(OnSaveFile2));
        MenuCommand configSep1 = new MenuCommand("-");
        MenuCommand configLF1  = new MenuCommand("Load from Config1.xml", new EventHandler(OnLoadFile1));
        MenuCommand configLF2  = new MenuCommand("Load from Config2.xml", new EventHandler(OnLoadFile2));
        MenuCommand configSep2 = new MenuCommand("-");
        MenuCommand configSA1  = new MenuCommand("Save to byte array1", new EventHandler(OnSaveArray1));
        MenuCommand configSA2  = new MenuCommand("Save to byte array2", new EventHandler(OnSaveArray2));
        MenuCommand configSep3 = new MenuCommand("-");
        MenuCommand configLA1  = new MenuCommand("Load from byte array1", new EventHandler(OnLoadArray1));
        MenuCommand configLA2  = new MenuCommand("Load from byte array2", new EventHandler(OnLoadArray2));

        topConfig.MenuCommands.AddRange(new MenuCommand[] { configSF1, configSF2, configSep1,
                                                            configLF1, configLF2, configSep2,
                                                            configSA1, configSA2, configSep3,
                                                            configLA1, configLA2 });

        // Settings
        MenuCommand settingsShow           = new MenuCommand("Allow Context Menu", new EventHandler(OnContextMenuAllow));
        MenuCommand settingsCustom         = new MenuCommand("Customize Context Menu", new EventHandler(OnContextMenuCustomize));
        MenuCommand settingsSep1           = new MenuCommand("-");
        MenuCommand settingsRSBD           = new MenuCommand("Default ResizeBarVector", new EventHandler(OnResizeBarDefault));
        MenuCommand settingsRSB1           = new MenuCommand("1 Pixel ResizeBarVector", new EventHandler(OnResizeBar1));
        MenuCommand settingsRSB5           = new MenuCommand("5 Pixel ResizeBarVector", new EventHandler(OnResizeBar5));
        MenuCommand settingsRSB7           = new MenuCommand("7 Pixel ResizeBarVector", new EventHandler(OnResizeBar7));
        MenuCommand settingsSep2           = new MenuCommand("-");
        MenuCommand settingsCaptionBars    = new MenuCommand("Show all caption bars", new EventHandler(OnCaptionBars));
        MenuCommand settingsCloseButtons   = new MenuCommand("Show all close buttons", new EventHandler(OnCloseButtons));
        MenuCommand settingsSep3           = new MenuCommand("-");
        MenuCommand settingsAllow          = new MenuCommand("Allow all close buttons", new EventHandler(OnAllowAllCloseButton));
        MenuCommand settingsIgnoreAll      = new MenuCommand("Ignore all close buttons", new EventHandler(OnIgnoreAllCloseButton));
        MenuCommand settingsIgnorePanel    = new MenuCommand("Ignore all Panel close buttons", new EventHandler(OnIgnoreAllPanelButton));
        MenuCommand settingsIgnoreForm     = new MenuCommand("Ignore all Form close buttons", new EventHandler(OnIgnoreAllFormButton));
        MenuCommand settingsIgnoreTextBox  = new MenuCommand("Ignore all RichTextBox close buttons", new EventHandler(OnIgnoreAllTextboxButton));
        MenuCommand settingsSep4           = new MenuCommand("-");
        MenuCommand settingsAllowMinMax    = new MenuCommand("Enable Min/Max in Columns/Rows", new EventHandler(OnAllowMinMax));
        MenuCommand settingsSep5           = new MenuCommand("-");
        MenuCommand settingsPlainTabBorder = new MenuCommand("Show Plain Tab Border", new EventHandler(OnPlainTabBorder));

        settingsShow.Update           += new EventHandler(OnUpdateAllow);
        settingsCustom.Update         += new EventHandler(OnUpdateCustomize);
        settingsRSBD.Update           += new EventHandler(OnUpdateRSBD);
        settingsRSB1.Update           += new EventHandler(OnUpdateRSB1);
        settingsRSB5.Update           += new EventHandler(OnUpdateRSB5);
        settingsRSB7.Update           += new EventHandler(OnUpdateRSB7);
        settingsCaptionBars.Update    += new EventHandler(OnUpdateCaptionBars);
        settingsCloseButtons.Update   += new EventHandler(OnUpdateCloseButtons);
        settingsAllow.Update          += new EventHandler(OnUpdateAllowAll);
        settingsIgnoreAll.Update      += new EventHandler(OnUpdateIgnoreAll);
        settingsIgnorePanel.Update    += new EventHandler(OnUpdateIgnorePanel);
        settingsIgnoreForm.Update     += new EventHandler(OnUpdateIgnoreForm);
        settingsIgnoreTextBox.Update  += new EventHandler(OnUpdateIgnoreTextBox);
        settingsAllowMinMax.Update    += new EventHandler(OnUpdateAllowMinMax);
        settingsPlainTabBorder.Update += new EventHandler(OnUpdatePlainTabBorder);

        topSettings.MenuCommands.AddRange(new MenuCommand[] { settingsShow, settingsCustom, settingsSep1, settingsRSBD,
                                                              settingsRSB1, settingsRSB5, settingsRSB7, settingsSep2,
                                                              settingsCaptionBars, settingsCloseButtons, settingsSep3,
                                                              settingsAllow, settingsIgnoreAll, settingsIgnorePanel,
                                                              settingsIgnoreForm, settingsIgnoreTextBox, settingsSep4,
                                                              settingsAllowMinMax, settingsSep5, settingsPlainTabBorder });


        // Colors
        MenuCommand colorDefault   = new MenuCommand("System Default", new EventHandler(OnColorDefault));
        MenuCommand colorSlateBlue = new MenuCommand("Custom - Slate Blue", new EventHandler(OnColorSlateBlue));
        MenuCommand colorFirebrick = new MenuCommand("Custom - Firebrick", new EventHandler(OnColorFirebrick));
        MenuCommand colorGreen     = new MenuCommand("Custom - Green", new EventHandler(OnColorGreen));

        colorDefault.Update   += new EventHandler(OnUpdateDefault);
        colorSlateBlue.Update += new EventHandler(OnUpdateSlateBlue);
        colorFirebrick.Update += new EventHandler(OnUpdateFirebrick);
        colorGreen.Update     += new EventHandler(OnUpdateGreen);

        topColors.MenuCommands.AddRange(new MenuCommand[] { colorDefault, colorSlateBlue, colorFirebrick, colorGreen });


        // TabControls
        MenuCommand tabsBox      = new MenuCommand("MultiBox", new EventHandler(OnTabsMultiBox));
        MenuCommand tabsForm     = new MenuCommand("MultiForm", new EventHandler(OnTabsMultiForm));
        MenuCommand tabsDocument = new MenuCommand("MultiDocument", new EventHandler(OnTabsMultiDocument));
        MenuCommand tabsSep1     = new MenuCommand("-");
        MenuCommand tabsTop      = new MenuCommand("Tabs at top", new EventHandler(OnTabsTop));
        MenuCommand tabsBottom   = new MenuCommand("Tabs at bottom", new EventHandler(OnTabsBottom));

        tabsBox.Update      += new EventHandler(OnUpdateTabsBox);
        tabsForm.Update     += new EventHandler(OnUpdateTabsForm);
        tabsDocument.Update += new EventHandler(OnUpdateTabsDocument);
        tabsTop.Update      += new EventHandler(OnUpdateTabsTop);
        tabsBottom.Update   += new EventHandler(OnUpdateTabsBottom);

        topTabControls.MenuCommands.AddRange(new MenuCommand[] { tabsBox, tabsForm, tabsDocument,
                                                                 tabsSep1, tabsTop, tabsBottom });

        topMenu.Dock = DockStyle.Top;
        Controls.Add(topMenu);

        return(topMenu);
    }
Ejemplo n.º 11
0
        internal MenuCommand TrackPopup(Point screenPos, 
            Point aboveScreenPos,
            Direction direction,
            MenuCommandCollection menuCollection,
            int borderGap,
            bool selectFirst,
            MenuControl parentControl,
            bool animateIn,
            ref int returnDir)
        {
            // Remember which direction the MenuControl is drawing in
            _direction = direction;

            // Remember the MenuControl that initiated us
            _parentControl = parentControl;

            // Remember the gap in drawing the top border
            _borderGap = borderGap;

            // Is this the first time a menu at this level has been animated
            _animateIn = animateIn;

            // Remember any currect menu item collection
            MenuCommandCollection oldCollection = _menuCommands;

            // Use the passed in collection of menu commands
            _menuCommands = menuCollection;

            // Remember screen positions
            _screenPos = screenPos;
            _aboveScreenPos = aboveScreenPos;
            _leftScreenPos = screenPos;

            MenuCommand ret = InternalTrackPopup(selectFirst);

            // Restore to original collection
            _menuCommands = oldCollection;

            // Remove reference no longer required
            _parentControl = null;

            // Return the direction key that caused dismissal
            returnDir = _returnDir;

            return ret;
        }
Ejemplo n.º 12
0
        protected MenuCommand InternalTrackPopup(Point screenPosTR, 
            Point screenPosTL,
            MenuCommandCollection menuCollection,
            PopupMenu parentMenu,
            bool selectFirst,
            MenuControl parentControl,
            bool popupRight,
            bool popupDown,
            bool animateIn,
            ref int returnDir)
        {
            // Default the drawing direction
            _direction = Direction.Horizontal;

            // Remember the MenuControl that initiated us
            _parentControl = parentControl;

            // We have a parent popup menu that should be consulted about operation
            _parentMenu = parentMenu;

            // Is this the first time a menu at this level has been animated
            _animateIn = animateIn;

            // Remember any currect menu item collection
            MenuCommandCollection oldCollection = _menuCommands;

            // Use the passed in collection of menu commands
            _menuCommands = menuCollection;

            // Remember screen positions
            _screenPos = screenPosTR;
            _aboveScreenPos = screenPosTR;
            _leftScreenPos = screenPosTL;

            // Remember display directions
            _popupRight = popupRight;
            _popupDown = popupDown;

            MenuCommand ret = InternalTrackPopup(selectFirst);

            // Restore to original collection
            _menuCommands = oldCollection;

            // Remove references no longer required
            _parentControl = null;
            _parentMenu = null;

            // Return the direction key that caused dismissal
            returnDir = _returnDir;

            return ret;
        }
Ejemplo n.º 13
0
        public PopupMenu()
        {
            // Create collection objects
            _drawCommands = new ArrayList();
            _menuCommands = new MenuCommandCollection();

            // Default the properties
            _returnDir = 0;
            _extraSize = 0;
            _popupItem = -1;
            _trackItem = -1;
            _childMenu = null;
            _exitLoop = false;
            _popupDown = true;
            _mouseOver = false;
            _excludeTop = true;
            _popupRight = true;
            _parentMenu = null;
            _excludeOffset = 0;
            _parentControl = null;
            _returnCommand = null;
            _controlLBrush = null;
            _controlEBrush = null;
            _controlLLBrush = null;
            _highlightInfrequent = false;
            _showInfrequent = false;
            _style = VisualStyle.IDE;
            _rememberExpansion = true;
            _lastMousePos = new Point(-1,-1);
            _direction = Direction.Horizontal;
            _textFont = SystemInformation.MenuFont;

            // Animation details
            _animateTime = 100;
            _animate = Animate.System;
            _animateStyle = Animation.System;
            _animateFirst = true;
            _animateIn = true;

            // Create and initialise the timer object (but do not start it running!)
            _timer = new Timer();
            _timer.Interval = _selectionDelay;
            _timer.Tick += new EventHandler(OnTimerExpire);

            // Define default colors
            _textColor = SystemColors.MenuText;
            _highlightTextColor = SystemColors.HighlightText;
            DefineHighlightColors(SystemColors.Highlight);
            DefineColors(SystemColors.Control);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(SampleForm));
     this.menuControl1  = new Crownwood.Magic.Menus.MenuControl();
     this.statusBar1    = new System.Windows.Forms.StatusBar();
     this.tabControl1   = new Crownwood.Magic.Controls.TabControl();
     this.mainTabs      = new System.Windows.Forms.ImageList(this.components);
     this.tabPage2      = new Crownwood.Magic.Controls.TabPage();
     this.tabbedGroups2 = new Crownwood.Magic.Controls.TabbedGroups();
     this.groupTabs     = new System.Windows.Forms.ImageList(this.components);
     this.tabPage1      = new Crownwood.Magic.Controls.TabPage();
     this.tabbedGroups1 = new Crownwood.Magic.Controls.TabbedGroups();
     this.tabPage3      = new Crownwood.Magic.Controls.TabPage();
     this.tabbedGroups3 = new Crownwood.Magic.Controls.TabbedGroups();
     this.tabPage2.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.tabbedGroups2)).BeginInit();
     this.tabPage1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.tabbedGroups1)).BeginInit();
     this.tabPage3.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.tabbedGroups3)).BeginInit();
     this.SuspendLayout();
     //
     // menuControl1
     //
     this.menuControl1.AnimateStyle       = Crownwood.Magic.Menus.Animation.System;
     this.menuControl1.AnimateTime        = 100;
     this.menuControl1.Cursor             = System.Windows.Forms.Cursors.Arrow;
     this.menuControl1.Direction          = Crownwood.Magic.Common.Direction.Horizontal;
     this.menuControl1.Dock               = System.Windows.Forms.DockStyle.Top;
     this.menuControl1.Font               = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
     this.menuControl1.HighlightTextColor = System.Drawing.SystemColors.MenuText;
     this.menuControl1.Name               = "menuControl1";
     this.menuControl1.Size               = new System.Drawing.Size(512, 25);
     this.menuControl1.Style              = Crownwood.Magic.Common.VisualStyle.IDE;
     this.menuControl1.TabIndex           = 0;
     this.menuControl1.TabStop            = false;
     this.menuControl1.Text               = "menuControl1";
     //
     // statusBar1
     //
     this.statusBar1.Location = new System.Drawing.Point(0, 455);
     this.statusBar1.Name     = "statusBar1";
     this.statusBar1.Size     = new System.Drawing.Size(512, 22);
     this.statusBar1.TabIndex = 1;
     this.statusBar1.Text     = "statusBar1";
     //
     // tabControl1
     //
     this.tabControl1.Dock          = System.Windows.Forms.DockStyle.Fill;
     this.tabControl1.HideTabsMode  = Crownwood.Magic.Controls.TabControl.HideTabsModes.ShowAlways;
     this.tabControl1.ImageList     = this.mainTabs;
     this.tabControl1.Location      = new System.Drawing.Point(0, 25);
     this.tabControl1.Name          = "tabControl1";
     this.tabControl1.SelectedIndex = 0;
     this.tabControl1.SelectedTab   = this.tabPage1;
     this.tabControl1.Size          = new System.Drawing.Size(512, 430);
     this.tabControl1.TabIndex      = 2;
     this.tabControl1.TabPages.AddRange(new Crownwood.Magic.Controls.TabPage[] {
         this.tabPage1,
         this.tabPage2,
         this.tabPage3
     });
     //
     // mainTabs
     //
     this.mainTabs.ColorDepth       = System.Windows.Forms.ColorDepth.Depth8Bit;
     this.mainTabs.ImageSize        = new System.Drawing.Size(16, 16);
     this.mainTabs.ImageStream      = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("mainTabs.ImageStream")));
     this.mainTabs.TransparentColor = System.Drawing.Color.Transparent;
     //
     // tabPage2
     //
     this.tabPage2.Controls.AddRange(new System.Windows.Forms.Control[] {
         this.tabbedGroups2
     });
     this.tabPage2.ImageIndex = 1;
     this.tabPage2.Name       = "tabPage2";
     this.tabPage2.Selected   = false;
     this.tabPage2.TabIndex   = 1;
     this.tabPage2.Title      = "Group2";
     //
     // tabbedGroups2
     //
     this.tabbedGroups2.ActiveLeaf         = null;
     this.tabbedGroups2.AllowDrop          = true;
     this.tabbedGroups2.AtLeastOneLeaf     = true;
     this.tabbedGroups2.Dock               = System.Windows.Forms.DockStyle.Fill;
     this.tabbedGroups2.ImageList          = this.groupTabs;
     this.tabbedGroups2.Name               = "tabbedGroups2";
     this.tabbedGroups2.ProminentLeaf      = null;
     this.tabbedGroups2.ResizeBarColor     = System.Drawing.SystemColors.Control;
     this.tabbedGroups2.Size               = new System.Drawing.Size(384, 301);
     this.tabbedGroups2.TabIndex           = 0;
     this.tabbedGroups2.TabControlCreated += new Crownwood.Magic.Controls.TabbedGroups.TabControlCreatedHandler(this.TabControlCreated);
     this.tabbedGroups2.PageSaving        += new Crownwood.Magic.Controls.TabbedGroups.PageSavingHandler(this.PageSaving);
     this.tabbedGroups2.ExternalDrop      += new Crownwood.Magic.Controls.TabbedGroups.ExternalDropHandler(this.ExternalDrop);
     this.tabbedGroups2.PageLoading       += new Crownwood.Magic.Controls.TabbedGroups.PageLoadingHandler(this.PageLoading);
     this.tabbedGroups2.GlobalLoading     += new Crownwood.Magic.Controls.TabbedGroups.GlobalLoadingHandler(this.GlobalLoading);
     this.tabbedGroups2.GlobalSaving      += new Crownwood.Magic.Controls.TabbedGroups.GlobalSavingHandler(this.GlobalSaving);
     //
     // groupTabs
     //
     this.groupTabs.ColorDepth       = System.Windows.Forms.ColorDepth.Depth8Bit;
     this.groupTabs.ImageSize        = new System.Drawing.Size(16, 16);
     this.groupTabs.ImageStream      = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("groupTabs.ImageStream")));
     this.groupTabs.TransparentColor = System.Drawing.Color.Transparent;
     //
     // tabPage1
     //
     this.tabPage1.Controls.AddRange(new System.Windows.Forms.Control[] {
         this.tabbedGroups1
     });
     this.tabPage1.ImageIndex = 0;
     this.tabPage1.Name       = "tabPage1";
     this.tabPage1.TabIndex   = 0;
     this.tabPage1.Title      = "Group1";
     //
     // tabbedGroups1
     //
     this.tabbedGroups1.ActiveLeaf         = null;
     this.tabbedGroups1.AllowDrop          = true;
     this.tabbedGroups1.AtLeastOneLeaf     = true;
     this.tabbedGroups1.Dock               = System.Windows.Forms.DockStyle.Fill;
     this.tabbedGroups1.ImageList          = this.groupTabs;
     this.tabbedGroups1.Name               = "tabbedGroups1";
     this.tabbedGroups1.ProminentLeaf      = null;
     this.tabbedGroups1.ResizeBarColor     = System.Drawing.SystemColors.Control;
     this.tabbedGroups1.Size               = new System.Drawing.Size(512, 405);
     this.tabbedGroups1.TabIndex           = 0;
     this.tabbedGroups1.TabControlCreated += new Crownwood.Magic.Controls.TabbedGroups.TabControlCreatedHandler(this.TabControlCreated);
     this.tabbedGroups1.PageSaving        += new Crownwood.Magic.Controls.TabbedGroups.PageSavingHandler(this.PageSaving);
     this.tabbedGroups1.ExternalDrop      += new Crownwood.Magic.Controls.TabbedGroups.ExternalDropHandler(this.ExternalDrop);
     this.tabbedGroups1.PageLoading       += new Crownwood.Magic.Controls.TabbedGroups.PageLoadingHandler(this.PageLoading);
     this.tabbedGroups1.GlobalLoading     += new Crownwood.Magic.Controls.TabbedGroups.GlobalLoadingHandler(this.GlobalLoading);
     this.tabbedGroups1.GlobalSaving      += new Crownwood.Magic.Controls.TabbedGroups.GlobalSavingHandler(this.GlobalSaving);
     //
     // tabPage3
     //
     this.tabPage3.Controls.AddRange(new System.Windows.Forms.Control[] {
         this.tabbedGroups3
     });
     this.tabPage3.ImageIndex = 2;
     this.tabPage3.Name       = "tabPage3";
     this.tabPage3.Selected   = false;
     this.tabPage3.TabIndex   = 2;
     this.tabPage3.Title      = "Group3";
     //
     // tabbedGroups3
     //
     this.tabbedGroups3.ActiveLeaf     = null;
     this.tabbedGroups3.AllowDrop      = true;
     this.tabbedGroups3.AtLeastOneLeaf = true;
     this.tabbedGroups3.Dock           = System.Windows.Forms.DockStyle.Fill;
     this.tabbedGroups3.ImageList      = this.groupTabs;
     this.tabbedGroups3.Name           = "tabbedGroups3";
     this.tabbedGroups3.ProminentLeaf  = null;
     this.tabbedGroups3.ResizeBarColor = System.Drawing.SystemColors.Control;
     this.tabbedGroups3.Size           = new System.Drawing.Size(384, 301);
     this.tabbedGroups3.TabIndex       = 0;
     this.tabbedGroups3.PageSaving    += new Crownwood.Magic.Controls.TabbedGroups.PageSavingHandler(this.PageSaving);
     this.tabbedGroups3.ExternalDrop  += new Crownwood.Magic.Controls.TabbedGroups.ExternalDropHandler(this.ExternalDrop);
     this.tabbedGroups3.PageLoading   += new Crownwood.Magic.Controls.TabbedGroups.PageLoadingHandler(this.PageLoading);
     this.tabbedGroups3.GlobalLoading += new Crownwood.Magic.Controls.TabbedGroups.GlobalLoadingHandler(this.GlobalLoading);
     this.tabbedGroups3.GlobalSaving  += new Crownwood.Magic.Controls.TabbedGroups.GlobalSavingHandler(this.GlobalSaving);
     //
     // SampleForm
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(512, 477);
     this.Controls.AddRange(new System.Windows.Forms.Control[] {
         this.tabControl1,
         this.menuControl1,
         this.statusBar1
     });
     this.Name = "SampleForm";
     this.Text = "Form1";
     this.tabPage2.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.tabbedGroups2)).EndInit();
     this.tabPage1.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.tabbedGroups1)).EndInit();
     this.tabPage3.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.tabbedGroups3)).EndInit();
     this.ResumeLayout(false);
 }