public void EndInit()
        {
            // Создадим кнопки
            buttons = new Dictionary <TabButtonStyle, NetTabButton>();
            buttons.Add(TabButtonStyle.LeftDown, new NetTabButton(this, TabButtonAction.Left));
            buttons.Add(TabButtonStyle.RightUp, new NetTabButton(this, TabButtonAction.Right));
            buttons.Add(TabButtonStyle.Action, new NetTabButton(this, TabButtonAction.Action));
            buttons.Add(TabButtonStyle.Close, new NetTabButton(this, TabButtonAction.Close));

            // Разместим кнопки на форме...
            CalculateLocationButtons();

            // и добавим их на нее
            for (int i = 0; i < 4; i++)
            {
                NetTabButton b = buttons[(TabButtonStyle)i];
                Controls.Add(b);
                b.ButtonPresed += new EventHandler <EventArgs>(ActionButtonPressed);
            }

            GenerateTitlePath();
        }
        void ActionButtonPressed(object sender, EventArgs e)
        {
            NetTabButton button = sender as NetTabButton;

            if ((button.ButtonAction == TabButtonAction.Left) || (button.ButtonAction == TabButtonAction.Up))
            {
                offsetX -= tabWidth;
                if (offsetX < 0)
                {
                    offsetX = 0;
                }
            }
            else if ((button.ButtonAction == TabButtonAction.Right) || (button.ButtonAction == TabButtonAction.Down))
            {
                int l = tabWidth;
                if (tabView == TabControlView.OneNote)
                {
                    l += tabHeight / 2 + 3;
                }

                offsetX += l;
                int full_l = l * TabPages.Count;
                int d;
                if (Alignment == TabAlignment.Top || Alignment == TabAlignment.Bottom)
                {
                    d = DefaultBoundsHeader.Width - BoundButtons.Width;
                }
                else
                {
                    d = DefaultBoundsHeader.Height - BoundButtons.Height;
                }

                if (full_l < d)
                {
                    offsetX = 0;
                }
                else
                {
                    if (d + offsetX > full_l)
                    {
                        offsetX = full_l - d;
                    }
                }
            }
            else if (button.ButtonAction == TabButtonAction.Action)
            {
                ContextMenuStrip menu = new ContextMenuStrip();
                foreach (NetTabPage page in TabPages)
                {
                    ToolStripMenuItem item = new ToolStripMenuItem();
                    item.Text = page.Title;
                    int n = TabPages.IndexOf(page);
                    item.Tag     = n;
                    item.Checked = (n == currentPage);
                    item.Click  += (senderItem, pe) => SelectedIndex = Convert.ToInt32((senderItem as ToolStripMenuItem).Tag);

                    menu.Items.Add(item);
                }

                menu.Show(button, 0, button.Size.Height);
            }

            Invalidate();
        }