Click here to Skip to main content
15,891,903 members
Articles / Desktop Programming / Windows Forms

Storm - the world's best IDE framework for .NET

Rate me:
Please Sign up or sign in to vote.
4.96/5 (82 votes)
4 Feb 2010LGPL311 min read 276.6K   6.5K   340  
Create fast, flexible, and extensible IDE applications easily with Storm - it takes nearly no code at all!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Storm.TabControl;
using Storm.TabControl.Base;
using Storm.TabControl.Design;
using Storm.TabControl.Helpers;

namespace TabControlTest
{
    public partial class Form1 : Form
    {
        private ToolStripDropDownMenu dropDown = new ToolStripDropDownMenu();

        public Form1()
        {
            InitializeComponent();
            TabToolStripMenuItem[] item = new TabToolStripMenuItem[1000];

            item[0] = new TabToolStripMenuItem(tabStrip);
            item[0].Text = "Close";
            item[0].Name = "btnClose";
            item[0].Visible = true;

            item[1] = new TabToolStripMenuItem(tabStrip);
            item[1].Text = "Close All But This";
            item[1].Name = "btnCloseABT";
            item[1].Visible = true;

            item[2] = new TabToolStripMenuItem(tabStrip);
            item[2].Text = "Close All";
            item[2].Name = "btnCloseAll";
            item[2].Visible = true;

            // Setup default actions
            item[0].UseDefaultAction = true;
            item[1].UseDefaultAction = true;
            item[2].UseDefaultAction = true;

            item[0].DefaultAction = TabDefaultAction.Close;
            item[1].DefaultAction = TabDefaultAction.CloseAllButThis;
            item[2].DefaultAction = TabDefaultAction.CloseAll;

            dropDown.Items.Add(item[0]);
            dropDown.Items.Add(item[1]);
            dropDown.Items.Add(item[2]);
            dropDown.DropShadowEnabled = true;

            tabStrip.RightClickMenu = dropDown;
            tabStrip.RightToLeft = RightToLeft.No;
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
			TabStripItem item = new TabStripItem("Caption " +
			Convert.ToString(tabStrip.Items.Count + 1), null);

			item.Controls.Add(new Button());

            tabStrip.AddTab(item, true);
        }

        private void btnRemove_Click(object sender, EventArgs e)
        {
            tabStrip.RemoveTab(tabStrip.SelectedItem);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)



Comments and Discussions