Ejemplo n.º 1
0
        private void _temp_Click(object sender, EventArgs e)
        {
            SingleTitle temp = (SingleTitle)sender;

            temp.Active();
            _tabcontrol.SelectedTab = temp.TabPage;
            foreach (SingleTitle _title in _titles)
            {
                if (_title != temp)
                {
                    _title.Deactive();
                }
            }
        }
Ejemplo n.º 2
0
        private void UpdateControl()
        {
            this.Size = new Size(0, 0);
            _titles.Clear();
            this.Controls.Clear();
            if (_tabcontrol != null)
            {
                int _index = 0;
                foreach (TabPage _page in _tabcontrol.TabPages)
                {
                    SingleTitle _temp = new SingleTitle();
                    _temp.TabPage = _page;
                    _temp.BackGroundColorNormal   = _backgroundcolornormal;
                    _temp.BackGroundColorHolver   = _backgroundcolorholver;
                    _temp.BackGroundColorSelected = _backgroundcolorselected;
                    _temp.TextColorNormal         = _textcolornormal;
                    _temp.TextColorHolver         = _textcolorholver;
                    _temp.TextColorSelected       = _textcolorselected;
                    _temp.TextLayout = _textlayouttitle;
                    _temp.Size       = _titlesize;
                    switch (_titlelayout)
                    {
                    case TitleLayout.Horizontal:
                        switch (_sizeLayout)
                        {
                        case sizelayout.AutoSize:
                            _temp.Size = new Size(TextRenderer.MeasureText(_page.Text, _page.Font, new Size(1000, 500)).Width + 5 + _titlepadding, _titlesize.Height);
                            try
                            {
                                _temp.Location = new Point(_titles[_titles.Count - 1].Location.X + _titles[_titles.Count - 1].Size.Width + _margin, 0);
                            }
                            catch
                            {
                                _temp.Location = new Point(_index * (_temp.Width + _margin), 0);
                            }
                            break;

                        case sizelayout.Manual:
                            _temp.Location = new Point(_index * (_temp.Width + _margin), 0);
                            break;
                            this.Size = new Size(this.Width + _temp.Width + _margin, _titlesize.Height);
                            break;
                        }
                        break;

                    case TitleLayout.Vertical:
                        _temp.TextPadding = _titlepadding;
                        _temp.Location    = new Point(0, _index * (_titlesize.Height + _margin));
                        this.Size         = new Size(_titlesize.Width, this.Height + _titlesize.Height + _margin);
                        break;
                    }
                    _temp.Click += _temp_Click;
                    _titles.Add(_temp);
                    this.Controls.Add(_temp);
                    _index++;
                    try
                    {
                        _titles[0].Active();
                    }
                    catch { }
                }
            }
        }