示例#1
0
        protected void OnPageDragStart(object sender, MouseEventArgs e)
        {
            if (this.RedockAllowed)
            {
                // There must be a selected page for this event to occur
                IDE.Controls.TabPage page = _tabControl.SelectedTab;

                // Event page must specify its Content object
                Content c = page.Tag as Content;

                // Remember the position of the tab before it is removed
                _dragPageIndex = _tabControl.TabPages.IndexOf(page);

                // Remove page from TabControl
                _tabControl.TabPages.Remove(page);

                // Force the entire window to redraw to ensure the Redocker does not start drawing
                // the XOR indicator before the window repaints itself. Otherwise the repainted
                // control will interfere with the XOR indicator.
                this.Refresh();

                // Start redocking activity for the single Content of this WindowContent
                _redocker = new RedockerContent(_tabControl, c, this, new Point(e.X, e.Y));
            }
        }
示例#2
0
        protected void OnDoubleClickTab(IDE.Controls.TabControl tc, IDE.Controls.TabPage page)
        {
            Content c = (Content)page.Tag;

            // Make Content record its current position and remember it for the future
            c.RecordRestore();

            // Invert docked status
            c.Docked = (c.Docked == false);

            // Remove from current WindowContent and restore its position
            _manager.HideContent(c, false, true);
            _manager.ShowContent(c);
        }
示例#3
0
        protected override void OnContentInserted(int index, object value)
        {
            base.OnContentInserted(index, value);

            Content content = value as Content;

            // Create TabPage to represent the Content
            IDE.Controls.TabPage newPage = new IDE.Controls.TabPage();

            // Reflect the Content properties int the TabPage
            newPage.Title      = content.Title;
            newPage.ImageList  = content.ImageList;
            newPage.ImageIndex = content.ImageIndex;
            newPage.Control    = content.Control;
            newPage.Tag        = content;

            // Reflect same order in TabPages collection as Content collection
            _tabControl.TabPages.Insert(index, newPage);
        }
示例#4
0
        protected void RestoreDraggingPage()
        {
            // Create TabPage to represent the Content
            IDE.Controls.TabPage newPage = new IDE.Controls.TabPage();

            Content content = _redocker.Content;

            // Reflect the Content properties int the TabPage
            newPage.Title = content.Title;

            newPage.ImageList  = content.ImageList;
            newPage.ImageIndex = content.ImageIndex;
            newPage.Control    = content.Control;
            newPage.Tag        = content;
            newPage.Selected   = true;

            // Put it back where it came from
            _tabControl.TabPages.Insert(_dragPageIndex, newPage);

            // Update the title displayed
            NotifyFullTitleText(content.FullTitle);
        }
示例#5
0
        public void HideCurrentContent()
        {
            IDE.Controls.TabPage tp = _tabControl.SelectedTab;

            int count = _tabControl.TabPages.Count;

            // Find currently selected tab
            int index = _tabControl.SelectedIndex;

            // Decide which other tab to make selected instead
            if (count > 1)
            {
                // Move to the next control along
                int newSelect = index + 1;

                // Wrap around to first tab if at end
                if (newSelect == count)
                {
                    newSelect = 0;
                }

                // Change selection
                _tabControl.SelectedIndex = newSelect;
            }
            else
            {
                // Hide myself as am about to die
                this.Hide();

                // Ensure the focus goes somewhere else
                _manager.Container.Focus();
            }

            if (tp != null)
            {
                // Have the manager perform the Hide operation for us
                _manager.HideContent(tp.Tag as Content);
            }
        }
示例#6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            // Fill background in required color
            if (_style == VisualStyle.IDE)
            {
                using (SolidBrush fillBrush = new SolidBrush(_backIDE))
                    e.Graphics.FillRectangle(fillBrush, this.ClientRectangle);
            }
            else
            {
                using (SolidBrush fillBrush = new SolidBrush(this.BackColor))
                    e.Graphics.FillRectangle(fillBrush, this.ClientRectangle);
            }

            // Style specific outline drawing
            DrawOutline(e.Graphics, true);

            // Draw border around area
            using (Pen borderPen = new Pen(ControlPaint.LightLight(this.ForeColor)))
            {
                // Draw each of the draw objects
                foreach (DrawTab dt in _drawTabs)
                {
                    Rectangle drawRect = dt.DrawRect;

                    AdjustRectForEdge(ref drawRect);

                    // Style specific cell outline drawing
                    DrawOutlineForCell(e.Graphics, borderPen, drawRect);

                    // Draw the image in the left/top of the cell
                    IDE.Controls.TabPage page = dt.TabPage;

                    int xDraw;
                    int yDraw;

                    switch (_edge)
                    {
                    case Edge.Left:
                    case Edge.Right:
                        xDraw = drawRect.Left + (drawRect.Width - _imageVector) / 2;
                        yDraw = drawRect.Top + _imageGap;
                        break;

                    case Edge.Top:
                    case Edge.Bottom:
                    case Edge.None:
                    default:
                        xDraw = drawRect.Left + _imageGap;
                        yDraw = drawRect.Top + (drawRect.Height - _imageVector) / 2;
                        break;
                    }

                    if ((page.ImageIndex != -1) && (page.ImageList != null))
                    {
                        // Draw the actual image
                        e.Graphics.DrawImage(page.ImageList.Images[page.ImageIndex],
                                             new Rectangle(xDraw, yDraw, _imageVector, _imageVector));
                    }

                    // Is anything currently selected
                    if (_selectedIndex != -1)
                    {
                        // Is this page selected?

                        if (page == _tabPages[_selectedIndex])
                        {
                            Rectangle textRect;

                            StringFormat drawFormat = new StringFormat();
                            drawFormat.FormatFlags   = StringFormatFlags.NoClip | StringFormatFlags.NoWrap;
                            drawFormat.Alignment     = StringAlignment.Center;
                            drawFormat.LineAlignment = StringAlignment.Center;

                            // Create text drawing rectangle
                            switch (_edge)
                            {
                            case Edge.Left:
                            case Edge.Right:
                                textRect = new Rectangle(drawRect.Left, yDraw + _imageVector + _imageGap,
                                                         drawRect.Width, drawRect.Height - _imageVector - _imageGap * 2);
                                drawFormat.FormatFlags |= StringFormatFlags.DirectionVertical;
                                break;

                            case Edge.Top:
                            case Edge.Bottom:
                            case Edge.None:
                            default:
                                textRect = new Rectangle(xDraw + _imageVector + _imageGap, drawRect.Top,
                                                         drawRect.Width - _imageVector - _imageGap * 2, drawRect.Height);
                                break;
                            }

                            Color brushColor = this.ForeColor;

                            if (_style == VisualStyle.IDE)
                            {
                                brushColor = ControlPaint.Light(brushColor);
                            }

                            using (SolidBrush drawBrush = new SolidBrush(brushColor))
                                e.Graphics.DrawString(page.Title, this.Font, drawBrush, textRect, drawFormat);
                        }
                    }
                }
            }

            // Style specific outline drawing
            DrawOutline(e.Graphics, false);

            base.OnPaint(e);
        }
示例#7
0
 public DrawTab(IDE.Controls.TabPage tabPage, Rectangle drawRect, int index)
 {
     _index    = index;
     _tabPage  = tabPage;
     _drawRect = drawRect;
 }