private void SwapTabPages(TabPage src, TabPage dst)
        {
            int srcIndex = TabPages.IndexOf(src);
            int dstIndex = TabPages.IndexOf(dst);

            if (PlatformHelper.GetPlatform() == Platform.Linux || PlatformHelper.GetPlatform() == Platform.OsX)
            {
                TabPages.Insert(dstIndex, src);
                TabPages.Insert(srcIndex, dst);
            }
            else
            {
                TabPages[dstIndex] = src;
                TabPages[srcIndex] = dst;
            }

            if (SelectedIndex == srcIndex)
            {
                SelectedIndex = dstIndex;
            }
            else if (SelectedIndex == dstIndex)
            {
                SelectedIndex = srcIndex;
            }

            Refresh();
        }
Esempio n. 2
0
        void Charts_ItemAdded(object sender, XListEventArgs <ChartPage> e)
        {
            var page = CreateNewPage(e.Item);

            page.IconChanged += Page_IconChanged;
            TabPages.Add(page);
        }
Esempio n. 3
0
        public void AdTabPage(string name, string caption, Color backColr = default(Color), char icon = (char)0, int index = -1)
        {
            TabPage tp = new TabPage(name, caption, icon);

            tp.Parent    = this;
            tp.BackColor = backColr;
            if (index >= 0 && index < TabPages.Count)
            {
                tp.TabIndex = TabPages [index].TabIndex;
                for (int i = index + 1; i < TabPages.Count; i++)
                {
                    TabPages [i].TabIndex++;
                }
                TabPages.Insert(index, tp);
            }
            else
            {
                if (TabPages.Count == 0)
                {
                    tp.TabIndex = 0;
                }
                else
                {
                    tp.TabIndex = TabPages.Last.TabIndex + 1;
                }
                TabPages.AddLast(tp);
            }
            TabBar.AddChild(tp.TabButton);
            tp.Selected |= TabPages.Count == 1;
            ResetCachedLayout();
        }
Esempio n. 4
0
        public bool IsOverCloseButton(Point p)
        {
            Rectangle r = GetTabRect(TabPages.IndexOf(TabPageFromPoint(p)));
            int       x = p.X - r.X, y = p.Y - r.Y;

            return(x > 4 && x < 24 && y > 1 && y < 17);
        }
Esempio n. 5
0
        /// <summary>
        /// 绘制
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            using (SolidBrush sb = new SolidBrush(Color.FromArgb(37, 37, 37)))
            {
                Rectangle all_back = new Rectangle(1, 1, Width - 2, Height - 2);  //整个背景区域
                e.Graphics.FillRectangle(sb, all_back);

                Rectangle back = new Rectangle(ItemSize.Width + 1, 1, Width - ItemSize.Width - 2, Height - 2);  //客户区
                e.Graphics.FillRectangle(Brushes.White, back);
                e.Graphics.DrawRectangle(Pens.Gray, back);

                foreach (TabPage tab in TabPages)  //Tab
                {
                    Rectangle tab_rect = GetTabRect(TabPages.IndexOf(tab));
                    tab_rect = new Rectangle(tab_rect.X - 1, tab_rect.Y - 1, tab_rect.Width, tab_rect.Height);
                    if (this.SelectedTab == tab || TabPages.IndexOf(tab) == _mouse_over)
                    {
                        using (SolidBrush bsb = new SolidBrush(Color.FromArgb(51, 133, 255)))
                        {
                            e.Graphics.FillRectangle(bsb, tab_rect);
                        }
                        e.Graphics.DrawString(tab.Text, new Font("微软雅黑", 10), Brushes.White, new PointF(tab_rect.X + 18, tab_rect.Y + 20));
                    }
                    else
                    {
                        e.Graphics.FillRectangle(sb, tab_rect);
                        e.Graphics.DrawString(tab.Text, new Font("微软雅黑", 10), Brushes.White, new PointF(tab_rect.X + 18, tab_rect.Y + 20));
                    }
                }
            }
        }
Esempio n. 6
0
        void _MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Middle)
            {
                // Find out which tab has been clicked & close that file.
                //
                for (int i = 0; i < TabCount; i++)
                {
                    if (GetTabRect(i).Contains(e.X, e.Y))
                    {
                        CloseFile((FileEditorTab)TabPages[i]);
                    }
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                // Left click already sets the target tab to selected so no need to do the stuff we do for the middle mouse button (looping through all the tabs)
                //
                int       tabIndex = TabPages.IndexOf(SelectedTab);
                Rectangle r        = ConvertRectangleBounds_CloseButton(GetTabRect(tabIndex));

                if (r.Contains(e.Location))
                {
                    CloseFile(this.SelectedFileTab);
                    SelectedIndex = tabIndex;
                }
            }
        }
Esempio n. 7
0
        private void InsertTabPage(System.Windows.Forms.TabPage[] originalOrder, System.Windows.Forms.TabPage page)
        {
            if (TabPages.Contains(page))
            {
                return;
            }
            if (originalOrder == null)
            {
                TabPages.Add(page);
            }
            System.Collections.Generic.Dictionary <System.Windows.Forms.TabPage, int> dictionary = new System.Collections.Generic.Dictionary <System.Windows.Forms.TabPage, int>();
            for (int i1 = 0; i1 < originalOrder.Length; i1++)
            {
                dictionary.Add(originalOrder[i1], i1);
            }
            if (!dictionary.ContainsKey(page))
            {
                TabPages.Add(page);
            }
            int i2 = dictionary[page];// (page);

            for (int i3 = 0; i3 < TabPages.Count; i3++)
            {
                System.Windows.Forms.TabPage tabPage = TabPages[i3];
                if (dictionary.ContainsKey(tabPage) && (dictionary[tabPage] > i2))
                {
                    TabPages.Insert(i3, page);
                    return;
                }
            }
            TabPages.Add(page);
        }
Esempio n. 8
0
        /// <summary>
        /// Add new tab page.
        /// </summary>
        /// <param name="text">Text of page.</param>
        public void AddPage(string text)
        {
            var page = new TabPage();

            page.BackColor = BackColor;
            TabPages.Add(page);
        }
Esempio n. 9
0
 void CalculateAll()
 {
     TabPages.UpdatePagesSettings(false);
     CalculateLocationButtons();
     GenerateTitlePath();
     Invalidate();
 }
Esempio n. 10
0
        public void HideTabPageByName(string tabPageName)
        {
            // The first time the Hide method is called, save the original order of the TabPages
            if (tabPagesOrder == null)
            {
                tabPagesOrder = new List <string>();
                foreach (System.Windows.Forms.TabPage tabPageCurrent in TabPages)
                {
                    tabPagesOrder.Add(tabPageCurrent.Name);
                }
            }

            if (TabPages.ContainsKey(tabPageName))
            {
                System.Windows.Forms.TabPage tabPageToHide;

                // Get the TabPage object
                tabPageToHide = TabPages[tabPageName];

                // Add the TabPage to the internal List
                tabPagesHidden.Add(tabPageName, tabPageToHide);

                // Remove the TabPage from the TabPages collection of the TabControl
                TabPages.Remove(tabPageToHide);
            }
        }
Esempio n. 11
0
        public void CloseTab(TabPage tp, bool askConfirmation = false)
        {
            int index = TabPages.IndexOf(tp);

            if (index < 0)
            {
                return;
            }

            if (!askConfirmation ||
                !Program.Model.Settings.ShowCloseTabConfirmation ||
                MessageBox.Show(
                    Program.Model.LocaleManager.GetLocalizedText(GetType().Name, "shouldClose"),
                    Program.Model.LocaleManager.GetLocalizedText(GetType().Name, "tabClose"),
                    MessageBoxButtons.YesNo, MessageBoxIcon.Question
                    ) == DialogResult.Yes
                )
            {
                TabPages.Remove(tp);

                SelectedIndex = index != 0 ? index - 1 : 0;

                this._btnCloseList.Clear();
                this._recreate = true;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Initializes this component.
        /// </summary>
        public PropertySetsTabControl()
        {
            InitializeComponent();

            createTabPage = new CreatePropertySetTabPage(this, "Create");
            TabPages.Add(createTabPage);
        }
Esempio n. 13
0
 private void closeTabsToTheLeftToolStripMenuItem_Click(object sender, EventArgs e)
 {
     for (var i = 0; TabPages[i] != SelectedTab && TabPages[i] != addTabPage;)
     {
         TabPages.RemoveAt(i);
     }
 }
Esempio n. 14
0
        public void AddTab(string filename = "")
        {
            if (TabPages.ContainsKey(filename))
            {
                return;
            }

            var tabPage = new TabPage();

            if (string.IsNullOrEmpty(filename))
            {
                tabPage.Text       = Strings.DocumentsTabControl_AddTab_NewFile + id;
                tabPage.ImageIndex = 1;
                tabPage.Name       = Strings.DocumentsTabControl_AddTab_NewFile + id;
            }
            else
            {
                tabPage.Text       = filename;
                tabPage.ImageIndex = 0;
                tabPage.Name       = filename;
            }
            TabPages.Insert(TabPages.Count - 1, tabPage);
            SelectedIndex = TabPages.IndexOf(tabPage);
            id++;
        }
Esempio n. 15
0
 private void FileTabControl_MouseClick(object sender, MouseEventArgs e)
 {
     for (int i = 0; i < TabPages.Count; i++)
     {
         Rectangle r           = GetTabRect(i);
         Rectangle closeButton = new Rectangle(r.Right - 15, r.Top + 4, 15, 9);
         if (closeButton.Contains(e.Location))
         {
             if (TabCount <= 1)
             {
                 return;
             }
             if (((EditorTab)TabPages[i]).CanClose())
             {
                 TabPages.RemoveAt(i);
             }
         }
         else if (r.Contains(e.Location) && e.Button == MouseButtons.Right)
         {
             contextMenuStrip.Tag = TabPages[i];
             contextMenuStrip.Items[1].Enabled = TabPages.Count > 1;
             contextMenuStrip.Show(this, e.Location);
         }
     }
 }
Esempio n. 16
0
        public void AddOpenedFilePage(string filePath)
        {
            // Create a rich text box and initialize style
            ExtRichTextBox fileRichTextBox = new ExtRichTextBox();

            fileRichTextBox.Dock = DockStyle.Fill;

            if (filePath.Length != 0)
            {
                // save path in rich text control name
                fileRichTextBox.Name     = filePath + " ";
                fileRichTextBox.filePath = filePath;
                fileRichTextBox.LoadFile(filePath, RichTextBoxStreamType.PlainText);
            }
            else
            {
                fileRichTextBox.Name     = "NewFile" + this.NewFileIndex.ToString() + " ";
                fileRichTextBox.Text     = "";
                fileRichTextBox.filePath = "";
                this.NewFileIndex++;
                // set filePath with a name since it will be displayed as tab page name
                filePath = fileRichTextBox.Name;
            }

            ExtTabPage newPage = new ExtTabPage(Path.GetFileName(filePath));

            TabPages.Add(newPage);
            TabPages[TabPages.Count - 1].Controls.Add(fileRichTextBox);
            SelectTab(TabPages.Count - 1);

            // open existed file and add it into tabcontrol always trigger Modifed; reset it
            fileRichTextBox.Modified = false;
        }
Esempio n. 17
0
        public void RemoveProviderPage(string name)
        {
            TabPage tabPage = GetTabPage(name);

            TabPages.Remove(tabPage);
            tabPage.Dispose();
        }
        /// <summary>
        /// Removes a tab
        /// </summary>
        /// <param name="Target">The tab that will be removed</param>
        public void ProfileTabRemove(TabPage Target)
        {
            if (ReadOnlyMode)
            {
                System.Media.SystemSounds.Beep.Play();
                return; // control not editable
            }

            // Remove tab but we still need to keep last regular one, the "New" and "Delete tabs.
            if (TabPages.Count <= 3)
            {
                return;
            }

            // Mono workaround: Selection required otherwise empty tab will be shown after deletion
            // Solution: Select last available tab (as it gets shifted due to deletion
            //           This way we force TabControl to re-select tab upon deletion
            SelectedIndex = TabPages.Count - 3;

            int index = TabPages.IndexOf(Target);

            ProfileTabSelectedHandler((ProfileViewControl)Target.Controls["pvc"], ProfileTabSelectAction.Deleting);
            TabPages.RemoveAt(index);

            for (int i = TabPages.Count - 3; 0 <= i; i--)
            {
                TabPages[i].Text = (i + 1).ToString(); // Update tab names
            }

            // Mono workaround: Selection required otherwise empty tab will be shown after deletion
            // Solution: Due to new selection the tab will be loaded properly again and no empty page is shown
            SelectedIndex = (index == 0 ? 0 : index - 1);
        }
Esempio n. 19
0
        /// <summary>
        /// Adds a new tab with the given control in it.
        /// </summary>
        /// <param name="tabText">The text to render on the tab.</param>
        /// <param name="control">The control to open in a new tab.</param>
        /// <param name="tabImage">The optional image to use with the tab.</param>
        /// <returns>Returns the created <see cref="TabPage"/>.</returns>
        public TabPage AddTabWithControl(string tabText, Control control, Image tabImage = null)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }

            // Create the tab
            var tab = new ExtendedTabPage(tabText, tabImage);

            // Add the control
            tab.Controls.Add(control);
            control.Dock = DockStyle.Fill;

            // Add to tab pages
            TabPages.Add(tab);
            SelectedTab = tab;

            // Resize
            ResizeTabs();

            // Notify
            if (TabOpened != null)
            {
                TabOpened(this, tab);
            }

            return(tab);
        }
Esempio n. 20
0
        public void CreateControle(
            CCreateur2iFormulaireV2 createur,
            C2iWnd wnd,
            Control parent,
            IFournisseurProprietesDynamiques fournisseurProprietes)
        {
            C2iWndTabControl tabControl = wnd as C2iWndTabControl;

            if (tabControl == null)
            {
                return;
            }
            Ombre = false;
            CCreateur2iFormulaireV2.AffecteProprietesCommunes(tabControl, this);
            parent.Controls.Add(this);
            List <IControleWndFor2iWnd> ctrlsFils = new List <IControleWndFor2iWnd>();

            foreach (C2iWndTabPage page in tabControl.TabPages)
            {
                IControleWndFor2iWnd fils = createur.CreateControle(page, this, fournisseurProprietes);
                ctrlsFils.Add(fils);
                if (fils.Control != null)
                {
                    TabPages.Add((Crownwood.Magic.Controls.TabPage)fils.Control);
                }
                fils.WndContainer = this;
            }
            m_controlesFils = ctrlsFils.ToArray();
            m_wndAssociee   = wnd;
        }
Esempio n. 21
0
        protected override void CloseTab(int index = -1)
        {
            if (SelectedIndex == -1)
            {
                return;
            }
            if (index == -1)
            {
                index = SelectedIndex;
            }
            if (TabPages.Count > 0)
            {
                var dwarfTabPage = TabPages[index];

                int newSelectedIndex = SelectedIndex;
                if (index <= SelectedIndex)
                {
                    newSelectedIndex = SelectedIndex - 1;
                }

                TabPages.Remove(dwarfTabPage);
                dwarfTabPage.Dispose();

                if (TabPages.Count > 0 && newSelectedIndex == -1)
                {
                    SelectedIndex = 0;
                }
                else
                {
                    SelectedIndex = newSelectedIndex;
                }
            }
        }
Esempio n. 22
0
        internal void ShowTab(TabPage tab, bool show)
        {
            var(index, bt) = FindBackingTab(tab, indexVisibleOnly: true);
            if (index < 0 || bt == null)
            {
                return;
            }

            if (show)
            {
                bt.Visible = true;
                if (!TabPages.Contains(bt.Tab))
                {
                    TabPages.Insert(Math.Min(index, TabCount), bt.Tab);
                }
            }
            else
            {
                bt.Visible = false;
                if (TabPages.Contains(bt.Tab))
                {
                    TabPages.Remove(bt.Tab);
                }
            }
        }
Esempio n. 23
0
        void OnDocumentChanged(Document old)
        {
            TabPages.Clear();

            if (old != null)
            {
                old.Charts.ItemAdded   -= new XListEventHandler <ChartPage>(Charts_ItemAdded);
                old.Charts.ItemRemoved -= new XListEventHandler <ChartPage>(Charts_ItemRemoved);
            }

            if (Document != null)
            {
                var activeIndex = Document.ActiveChartIndex;
                foreach (var chart in Document.Charts)
                {
                    var page = CreateNewPage(chart);
                    page.IconChanged += Page_IconChanged;
                    TabPages.Add(page);
                }

                if (activeIndex > -1 && activeIndex < TabPages.Count)
                {
                    ActivePage(activeIndex);
                }

                Document.Charts.ItemAdded   += new XListEventHandler <ChartPage>(Charts_ItemAdded);
                Document.Charts.ItemRemoved += new XListEventHandler <ChartPage>(Charts_ItemRemoved);
                Document.ModifiedChanged    += Document_ModifiedChanged;
            }
        }
Esempio n. 24
0
        public void Repos(TabPage tpCurrent)
        {
            Button btnClose = CloseButton(tpCurrent);

            if (btnClose != null)
            {
                int tpIndex = TabPages.IndexOf(tpCurrent);
                if (tpIndex >= 0)
                {
                    Rectangle rctCurrent = GetTabRect(tpIndex);

                    if (SelectedTab == tpCurrent)
                    {
                        btnClose.Size     = new Size(rctCurrent.Height - 1, rctCurrent.Height - 1);
                        btnClose.Location = new Point(rctCurrent.X + rctCurrent.Width - rctCurrent.Height, rctCurrent.Y + 1);
                    }
                    else
                    {
                        btnClose.Size     = new Size(rctCurrent.Height - 3, rctCurrent.Height - 2);
                        btnClose.Location = new Point(rctCurrent.X + rctCurrent.Width - rctCurrent.Height - 1, rctCurrent.Y + 1);
                    }

                    btnClose.Visible = ShowCloseButtons;
                    btnClose.BringToFront();
                }
            }
        }
Esempio n. 25
0
        public void CreateFeedList(PodcastFeed podcastFeed)
        {
            var feedTab = new TabPage();

            tabCtrlFeeds.TabPages.Add(feedTab);

            var feedList = new ListBox();

            feedList.Dock = DockStyle.Fill;
            feedTab.Controls.Add(feedList);

            var rss  = WebFetcher.FetchRss(podcastFeed.Url);
            var feed = RssParser.GetPodcastFeed(rss);

            podcastFeed.PodcastEpisodes = feed.PodcastEpisodes;
            feedTab.Text = podcastFeed.Name;

            foreach (PodcastEpisode podcast in podcastFeed.PodcastEpisodes)
            {
                feedList.Items.Add(podcast.Name);
            }

            ActiveRss.Add(podcastFeed.Id, rss);
            TabPages.Add(podcastFeed.Id, feedTab);
            UpdateClocks.Add(podcastFeed.Id, new UpdateClock(podcastFeed));

            SetUpdateClocks();
            UpdateClocks[podcastFeed.Id].Start();
        }
        protected override void OnDragDrop(DragEventArgs drgevent)
        {
            if (AllowDrop)
            {
                try
                {
                    if (mblnDragging)
                    {
                        TabPages.Clear();
                        TabPages.AddRange((TabPage[])mPages.ToArray(typeof(TabPage)));
                        SelectedTab  = mDragTab;
                        mblnDragging = false;
                        mDragTab     = null;

                        if (AfterDragDrop != null)
                        {
                            AfterDragDrop(this, EventArgs.Empty);
                        }
                    }
                }
                catch
                {
                }
            }
        }
Esempio n. 27
0
        public void RemoveSettingsPage()
        {
            TabPage tabPage = GetTabPage(SettingsTabName);

            TabPages.Remove(tabPage);
            tabPage.Dispose();
        }
Esempio n. 28
0
 public void TabPagesClear()
 {
     while (TabPages.Count > 1)
     {
         TabPages.RemoveAt(TabPages.Count - 1);
     }
 }
Esempio n. 29
0
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.Clear(Color.White);
            foreach (TabPage tabPage in TabPages)
            {
                int       curIndex = TabPages.IndexOf(tabPage);
                Rectangle tabRect  = GetTabRect(curIndex);
                var       titleR   = new Rectangle(tabRect.X, tabRect.Y, tabRect.Width, tabRect.Height);
                var       ntr      = new Rectangle(tabRect.X + (curIndex == 0 ? 2 : 0), (tabRect.Y + tabRect.Height) - 3, tabRect.Width - (curIndex == 0 ? 4 : 2), 2);

                if (Alignment == TabAlignment.Top)
                {
                    e.Graphics.FillRectangle(SelectedIndex == curIndex ? Color.FromArgb(243, 63, 63) : Color.Silver, ntr);
                    e.Graphics.DrawString(tabPage.Text, Font, Color.Black, titleR, StringAlignment.Center);
                }
                else if (Alignment == TabAlignment.Right)
                {
                    titleR = new Rectangle(titleR.X + 4, titleR.Y, titleR.Width, titleR.Height);
                    ntr    = new Rectangle(tabRect.X, tabRect.Y + (curIndex == 0 ? 2 : 0), 2, tabRect.Height - (curIndex == 0 ? 4 : 2));
                    e.Graphics.FillRectangle(SelectedIndex == curIndex ? Color.FromArgb(243, 63, 63) : Color.Silver, ntr);
                    e.Graphics.DrawString(tabPage.Text, Font, Color.Black, titleR, StringAlignment.Near, StringAlignment.Center);
                }
            }

            if (_displayBoundary)
            {
                e.Graphics.DrawLine(Color.FromArgb(243, 63, 63), 0, Height - 1, Width - 1, Height - 1);
            }
            base.OnPaint(e);
        }
Esempio n. 30
0
        protected override void Render(HtmlTextWriter writer)
        {
            bool   noTabs   = false;
            string selected = null;

            // If no tabs have been defined in design mode write a canned HTML display
            if (DesignMode && TabPages.Count == 0)
            {
                noTabs = true;
                AddTab("No Tabs", "default", "Tab1");
                AddTab("No Tabs 2", "default", "Tab2");
                selected    = SelectedTab;
                SelectedTab = "Tab2";
            }

            // Render the actual control
            RenderControl();

            // Dump the output into the ASP out stream
            writer.Write(Output);

            // Call the base to let it output the writer's output
            base.Render(writer);

            if (noTabs)
            {
                TabPages.Clear();
                SelectedTab = selected;
            }
        }
Esempio n. 31
0
 public Load(MultiBoard board, TabPages.PageCollection Tabs, EventHandler rightClickHandler)
 {
     InitializeComponent();
     DialogResult = DialogResult.Cancel;
     styleManager.ManagerStyle = UserSettings.applicationStyle;
     this.multiBoard = board;
     this.Tabs = Tabs;
     this.rightClickHandler = rightClickHandler;
 }
Esempio n. 32
0
 private void Tabs_PageClosing(TabPages.TabPage page, ref bool cancel)
 {
     Form msgbx = new GUI.YesNoBox("Close", "Are you sure you want to close this map?");
     //  MessageBox.Show("Are you sure you want to close this map?", "Close", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
     if (msgbx.DialogResult != DialogResult.Yes)
         cancel = true;
 }
Esempio n. 33
0
 private void Tabs_CurrentPageChanged(TabPages.TabPage currentPage, TabPages.TabPage previousPage)
 {
     if (previousPage != null)
     {
         allLayersBox.Enabled = true;
         layersComboBox.Enabled = true;
         ((Board)previousPage.Tag).Mouse.SelectionMode();
         InputHandler.ClearSelectedItems((Board)previousPage.Tag);
     }
     multiBoard.SelectedBoard = (Board)currentPage.Tag;
     multiBoard.Focus();
     //ApplicationSettings.visibleTypes = prevVisibleTypes;
     //ApplicationSettings.editedTypes = prevEditedTypes;
     //ParseVisibleEditedTypes();
     if (multiBoard.SelectedBoard.SelectedLayerIndex == -1) allLayersBox.Checked = true;
     else { allLayersBox.Checked = false; layersComboBox.SelectedIndex = multiBoard.SelectedBoard.SelectedLayerIndex; }
     SetLayerTSInComboBox();
     multiBoard.RenderFrame();
 }
 public void ChangePage()
 {
     String tag = _tabControl.SelectedTab.Tag as String;
     _currentPage = (TabPages)Enum.Parse(typeof(TabPages), tag);
 }
        void SelectTabPage(TabPages tabPage)
        {
            // Select new tab page
            selectedTabPage = tabPage;

            // Reset scrollbar
            localItemsScrollBar.Reset(listDisplayUnits);

            // Clear all button selections
            weaponsAndArmorButton.BackgroundTexture = weaponsAndArmorNotSelected;
            magicItemsButton.BackgroundTexture = magicItemsNotSelected;
            clothingAndMiscButton.BackgroundTexture = clothingAndMiscNotSelected;
            ingredientsButton.BackgroundTexture = ingredientsNotSelected;

            // Set new button selection texture background
            switch (tabPage)
            {
                case TabPages.WeaponsAndArmor:
                    weaponsAndArmorButton.BackgroundTexture = weaponsAndArmorSelected;
                    break;
                case TabPages.MagicItems:
                    magicItemsButton.BackgroundTexture = magicItemsSelected;
                    break;
                case TabPages.ClothingAndMisc:
                    clothingAndMiscButton.BackgroundTexture = clothingAndMiscSelected;
                    break;
                case TabPages.Ingredients:
                    ingredientsButton.BackgroundTexture = ingredientsSelected;
                    break;
            }

            // Update filtered list
            FilterLocalItems();
            UpdateLocalItemsDisplay();
        }
Esempio n. 36
0
 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;
 }
Esempio n. 37
0
 private void Tabs_PageClosing(TabPages.TabPage page, ref bool cancel)
 {
     if (MessageBox.Show("Are you sure you want to close this map?", "Close", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
         cancel = true;
 }