예제 #1
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (_rectItems.Length != this.TabPages.Count)
            {
                _rectItems = new Rectangle[this.TabPages.Count];
            }

            int i = e.Index;

            if (i < 0 || i >= this.TabPages.Count)
            {
                return;
            }

            //if (this.TabPages[i].BackColor != this.BackColorTabPages)
            //  this.TabPages[i].BackColor = this.BackColorTabPages;

            _rectItems[i] = this.GetTabRect(i);

            if (i == 0)
            {
                _itemsRect = _rectItems[i];
                TabPage tp = this.TabPages[0];
                Point   p  = this.PointToClient(tp.PointToScreen(new Point(0, 0)));
                _tabPagesRect   = tp.Bounds;
                _tabPagesRect.X = p.X;
                _tabPagesRect.Y = p.Y;
            }
            else
            {
                switch (this.Alignment)
                {
                case TabAlignment.Bottom:
                case TabAlignment.Top:
                    _itemsRect.Width += _rectItems[e.Index].Width;
                    break;

                case TabAlignment.Left:
                case TabAlignment.Right:
                    _itemsRect.Height += _rectItems[e.Index].Height;
                    break;
                }
            }
        }
예제 #2
0
        private void ToggleCompactMode(PpuViewerMode mode, ICompactControl control, TabPage tab, string title)
        {
            if (!_isCompact)
            {
                Point tabTopLeft        = tabMain.PointToScreen(Point.Empty);
                Point tabContentTopLeft = tab.PointToScreen(Point.Empty);

                int heightGap = tabContentTopLeft.Y - tabTopLeft.Y + ctrlScanlineCycle.Height;

                _isCompact    = true;
                _originalSize = this.Size;
                Size size       = control.GetCompactSize(true);
                int  widthDiff  = ((Control)control).Width - size.Width;
                int  heightDiff = ((Control)control).Height - size.Height;

                this.Controls.Add((Control)control);
                ((Control)control).BringToFront();

                tabMain.Visible           = false;
                ctrlScanlineCycle.Visible = false;
                this.Text = title;

                this.Size = new Size(this.Width - widthDiff, this.Height - heightDiff - heightGap + 3);
            }
            else
            {
                _mode           = PpuViewerMode.Combined;
                _isCompact      = false;
                this.Size       = _originalSize;
                tabMain.Visible = true;
                tab.Controls.Add((Control)control);
                ctrlScanlineCycle.Visible = true;
                this.Text = "PPU Viewer";
            }

            btnToggleView.Image = _isCompact ? Properties.Resources.Expand : Properties.Resources.Collapse;
        }