コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mapName"></param>
        /// <param name="mapId">May be -1 if none.</param>
        /// <param name="tooltip"></param>
        /// <param name="menu"></param>
        /// <param name="size"></param>
        /// <param name="center"></param>
        /// <param name="layers"></param>
        /// <param name="Tabs"></param>
        /// <param name="multiBoard"></param>
        public void CreateMap(string mapName, int mapId, string tooltip, System.Windows.Controls.ContextMenu menu, Point size, Point center, int layers, System.Windows.Controls.TabControl Tabs, MultiBoard multiBoard)
        {
            lock (multiBoard)
            {
                Board newBoard = multiBoard.CreateBoard(size, center, layers, menu);
                GenerateDefaultZms(newBoard);

                System.Windows.Controls.TabItem newTabPage = new System.Windows.Controls.TabItem();
                newTabPage.Header              = string.Format("[{0}] {1}", mapId == -1 ? "" : mapId.ToString(), mapName); // Header of the tab
                newTabPage.MouseRightButtonUp += (sender, e) =>
                {
                    System.Windows.Controls.TabItem senderTab = (System.Windows.Controls.TabItem)sender;

                    menu.PlacementTarget = senderTab;
                    menu.IsOpen          = true;
                };

                newBoard.TabPage = newTabPage;
                newTabPage.Tag   = new TabItemContainer(mapName, multiBoard, tooltip, menu, newBoard); //newBoard;
                Tabs.Items.Add(newTabPage);
                Tabs.SelectedItem = newTabPage;

                multiBoard.SelectedBoard = newBoard;
                menu.Tag = newBoard;
                foreach (System.Windows.Controls.MenuItem item in menu.Items)
                {
                    item.Tag = newTabPage;
                }
            }
        }
コード例 #2
0
ファイル: MapLoader.cs プロジェクト: xnum/hasuite
        public static void CreateMap(string text, string tooltip, ContextMenuStrip menu, Point size, Point center, int layers, TabPages.PageCollection Tabs, MultiBoard multiBoard)
        {
            Board newBoard = multiBoard.CreateBoard(size, center, layers);

            TabPages.TabPage page = new TabPages.TabPage(text, multiBoard, tooltip, menu);
            page.Tag = newBoard;
            Tabs.Add(page);
            Tabs.CurrentPage         = page;
            multiBoard.SelectedBoard = newBoard;
            menu.Tag = newBoard;
            foreach (ToolStripItem item in menu.Items)
            {
                item.Tag = newBoard;
            }
        }
コード例 #3
0
 public void CreateMap(string text, string tooltip, ContextMenuStrip menu, Point size, Point center, int layers, HaCreator.ThirdParty.TabPages.PageCollection Tabs, MultiBoard multiBoard)
 {
     lock (multiBoard)
     {
         Board newBoard = multiBoard.CreateBoard(size, center, layers, menu);
         GenerateDefaultZms(newBoard);
         HaCreator.ThirdParty.TabPages.TabPage page = new HaCreator.ThirdParty.TabPages.TabPage(text, multiBoard, tooltip, menu);
         newBoard.TabPage = page;
         page.Tag         = newBoard;
         Tabs.Add(page);
         Tabs.CurrentPage         = page;
         multiBoard.SelectedBoard = newBoard;
         menu.Tag = newBoard;
         foreach (ToolStripItem item in menu.Items)
         {
             item.Tag = newBoard;
         }
     }
 }