示例#1
0
 public void OnAction(cnTabButton sender, TabButtonAction action)
 {
     if (Action != null)
     {
         Action(this, action);
     }
 }
示例#2
0
        private void buttonAction(cnTabButton sender, TabButtonAction action)
        {
            if ((action == TabButtonAction.Left) || (action == TabButtonAction.Up))
            {
                offsetX -= tabWidth;
                if (offsetX < 0)
                {
                    offsetX = 0;
                }
            }
            else if ((action == TabButtonAction.Right) || (action == TabButtonAction.Down))
            {
                int l = tabWidth;
                if (tabView == TabControlView.OneNote)
                {
                    l += tabHeight / 2 + 3;
                }
                offsetX += l;
                int       full_l = l * TabPages.Count;
                Rectangle r      = this.GetBoundsHeader(0);
                Rectangle rb     = this.GetBoundsButtons();
                int       d;
                if ((Alignment == TabAlignment.Top) || (Alignment == TabAlignment.Bottom))
                {
                    d = r.Width - rb.Width;
                }
                else
                {
                    d = r.Height - rb.Height;
                }

                if (full_l < d)
                {
                    offsetX = 0;
                }
                else
                if (d + offsetX > full_l)
                {
                    offsetX = full_l - d;
                }
            }
            else if (action == TabButtonAction.Action)
            {
                ContextMenuStrip menu = new ContextMenuStrip();
                foreach (cnTabPage tb in TabPages)
                {
                    ToolStripMenuItem item = new System.Windows.Forms.ToolStripMenuItem();
                    item.Text = tb.Title;
                    int n = TabPages.IndexOf(tb);
                    item.Tag     = n;
                    item.Checked = (n == currentPage);
                    item.Click  += new System.EventHandler(ItemClickMenu);
                    menu.Items.Add(item);
                }
                menu.Show(sender, 0, sender.Size.Height);
            }
            Invalidate();
        }
示例#3
0
        public NetTabButton(NetTabControl owner, TabButtonAction action)
        {
            this.buttonAction = action;
            this.owner        = owner;

            this.selected = false;
            this.down     = false;

            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.UserPaint, true);

            SetStyle(ControlStyles.FixedHeight, true);
            SetStyle(ControlStyles.FixedWidth, true);

            Size    = new Size(15, 15);
            Visible = false;
            TabStop = false;
        }
示例#4
0
        public cnTabButton(cnTabControl Tab, TabButtonAction action)
        {
            buttonAction = action;
            selected     = false;
            down         = false;

            tab = Tab;
            bg  = new SolidBrush(tab.BackColor);

            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.UserPaint, true);

            SetStyle(ControlStyles.FixedHeight, true);
            SetStyle(ControlStyles.FixedWidth, true);

            this.Size = new Size(15, 15);

            this.Visible = false;
            this.TabStop = false;
        }