public void DrawPage(Graphics g, StiTabTitlePosition position, StiTabulatorPage page)
        {
            var rect     = new Rectangle(0, 0, page.Width - 1, page.Height - 1);
            var pageRect = ((StiTabulator)page.Parent).GetTitlePageRectangle(g, page);

            using (Pen penLight = new Pen(StiColorUtils.Light(SystemColors.Control, 30)),
                   penDark = new Pen(StiColorUtils.Dark(SystemColors.Control, 50)))
            {
                DrawDot(g, 0, 0);
                DrawDot(g, rect.Right, 0);
                DrawDot(g, rect.Right, rect.Bottom);
                DrawDot(g, 0, rect.Bottom);


                switch (position)
                {
                case StiTabTitlePosition.LeftHorizontal:
                    DrawPageLeftHorizontal(g, page, penLight, penDark, rect, pageRect);
                    break;

                case StiTabTitlePosition.TopHorizontal:
                    DrawPageTopHorizontal(g, page, penLight, penDark, rect, pageRect);
                    break;

                case StiTabTitlePosition.RightHorizontal:
                    DrawPageRightHorizontal(g, page, penLight, penDark, rect, pageRect);
                    break;
                }
            }
        }
        public void DrawPageTitle(Graphics g, StiTabTitlePosition position, StiTabulatorPage page)
        {
            var       rect = tabulator.GetTitlePageRectangle(g, page);
            Rectangle contentRect;

            if (rect.Width != 0 && rect.Height != 0)
            {
                using (Pen penLight = new Pen(StiColorUtils.Light(SystemColors.Control, 30)),
                       penDark = new Pen(StiColorUtils.Dark(SystemColors.Control, 50)))
                {
                    switch (position)
                    {
                    case StiTabTitlePosition.LeftHorizontal:
                        contentRect = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 1, rect.Height - 1);
                        DrawPageTitleLeftHorizontal(g, penLight, penDark, page, rect, contentRect);
                        break;

                    case StiTabTitlePosition.TopHorizontal:
                        contentRect = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 1, rect.Height - 1);
                        DrawPageTitleTopHorizontal(g, penLight, penDark, page, rect, contentRect);
                        break;

                    case StiTabTitlePosition.RightHorizontal:
                        contentRect = new Rectangle(rect.X, rect.Y + 3, rect.Width, rect.Height);
                        DrawPageTitleRightHorizontal(g, penLight, penDark, page, rect, contentRect);
                        break;
                    }
                }
            }
        }
 private void DrawPageTitle(Graphics g, StiTabulatorPage page)
 {
     if ((!page.Invisible) || DesignMode)
     {
         Mode.DrawPageTitle(g, page);
     }
 }
Exemplo n.º 4
0
        public override Rectangle GetTitleImageRectangle(Rectangle rect, StiTabulatorPage page)
        {
            SizeF imageSize = SizeF.Empty;

            if (tabulator.ImageList != null || page.Image != null)
            {
                if (tabulator.ImageList != null || page.Image != null)
                {
                    if (page.Image != null)
                    {
                        imageSize = page.Image.Size;
                    }
                    else
                    {
                        imageSize = tabulator.ImageList.ImageSize;
                    }

                    int width = 4;
                    if (rect.Width > 0)
                    {
                        width = ((int)((rect.Width - imageSize.Width) / 2));
                    }

                    return(new Rectangle(rect.X + width,
                                         rect.Y + 10,
                                         (int)imageSize.Width, (int)imageSize.Height));
                }
            }
            return(Rectangle.Empty);
        }
Exemplo n.º 5
0
 private void DrawPageRightHorizontal(Graphics g, StiTabulatorPage page, Pen penDark, Rectangle rect)
 {
     if (((StiTabulator)page.Parent).ShowTitle)
     {
         penDark.Color       = Color.FromArgb(198, 198, 198);
         penDark.DashPattern = new float[] { 1f, 2f };
         g.DrawLine(penDark, rect.Right, rect.Top, rect.Right, rect.Bottom);
     }
 }
Exemplo n.º 6
0
        private void OnAddControl(object sender, EventArgs e)
        {
            IDesignerHost       host        = ((IDesignerHost)base.GetService(typeof(IDesignerHost)));
            DesignerTransaction transaction = host.CreateTransaction("Add Page");
            StiTabulatorPage    control     = ((StiTabulatorPage)host.CreateComponent(typeof(StiTabulatorPage)));

            this.tabControl.Controls.Add(control);
            control.Dock = DockStyle.Fill;
            this.tabControl.Invalidate();
            transaction.Commit();
        }
Exemplo n.º 7
0
        public virtual Rectangle GetTitleTextRectangle(Rectangle rect, StiTabulatorPage page)
        {
            Rectangle imageRect = GetTitleImageRectangle(rect, page);

            if (imageRect.IsEmpty)
            {
                return(rect);
            }
            rect.Width -= imageRect.Width;
            rect.X     += imageRect.Width;
            return(rect);
        }
Exemplo n.º 8
0
        public override Rectangle GetTitleTextRectangle(Rectangle rect, StiTabulatorPage page)
        {
            Rectangle imageRect = GetTitleImageRectangle(rect, page);

            if (imageRect.IsEmpty)
            {
                return(rect);
            }
            rect.Y      += imageRect.Height + 4;
            rect.Height -= imageRect.Height;

            return(rect);
        }
Exemplo n.º 9
0
        public override void DrawTitleText(Graphics g, Rectangle rect, StiTabulatorPage page)
        {
            Rectangle textRect = GetTitleTextRectangle(rect, page);

            var stringFormat = new StringFormat
            {
                HotkeyPrefix  = System.Drawing.Text.HotkeyPrefix.Show,
                LineAlignment = StringAlignment.Center,
                Alignment     = StringAlignment.Center,
                Trimming      = StringTrimming.EllipsisCharacter
            };

            g.DrawString(page.Text, tabulator.Font, SystemBrushes.ControlText, textRect, stringFormat);
        }
Exemplo n.º 10
0
 protected override void WndProc(ref Message msg)
 {
     if (msg.Msg == (int)Win32.Msg.WM_LBUTTONDOWN)
     {
         Point            p    = tabControl.PointToClient(Cursor.Position);
         StiTabulatorPage page = tabControl.GetTabPageAtPoint(p);
         if (page != null)
         {
             tabControl.SelectedTab = page;
             var controls = new ArrayList();
             controls.Add(page);
             ISelectionService service = ((ISelectionService)this.GetService(typeof(ISelectionService)));
             service.SetSelectedComponents(controls);
         }
     }
     base.WndProc(ref msg);
 }
Exemplo n.º 11
0
        public virtual void DrawTitleImage(Graphics g, Rectangle rect, StiTabulatorPage page)
        {
            Rectangle imageRect = GetTitleImageRectangle(rect, page);

            if (!imageRect.IsEmpty)
            {
                int pageIndex = page.PageIndex;

                if (tabulator.ImageList != null && tabulator.ImageList.Images.Count > pageIndex)
                {
                    tabulator.ImageList.Draw(g, imageRect.X, imageRect.Y, imageRect.Width, imageRect.Height, pageIndex);
                }
                else if (page.Image != null)
                {
                    g.DrawImage(page.Image, imageRect.X, imageRect.Y, imageRect.Width, imageRect.Height);
                }
            }
        }
        public override Rectangle GetTitlePageRectangle(StiTabulatorPage page)
        {
            int pos = startPosTitle;

            foreach (StiTabulatorPage pg in page.Parent.Controls)
            {
                if (pg == page)
                {
                    break;
                }
                if ((!pg.Invisible) || tabulator.IsDesignMode)
                {
                    pos += pg.TitleSize.Width;
                }
            }
            return(new Rectangle(
                       pos, titleSpace,
                       page.TitleSize.Width, tabulator.MaxTitleHeight));
        }
Exemplo n.º 13
0
        private void DrawPageLeftHorizontal(Graphics g, StiTabulatorPage page, Pen penLight, Pen penDark, Rectangle rect, Rectangle pageRect)
        {
            g.DrawLine(penDark, rect.X, rect.Y, rect.Right, rect.Y);
            g.DrawLine(penDark, rect.Right, rect.Top, rect.Right, rect.Bottom);
            g.DrawLine(penDark, rect.X, rect.Bottom, rect.Right, rect.Bottom);

            if (((StiTabulator)page.Parent).ShowTitle)
            {
                g.DrawLine(penLight, rect.X + 1, rect.Y + 1, rect.X + 1, pageRect.Y - 1);
                g.DrawLine(penDark, rect.X, rect.Y + 1, rect.X, pageRect.Y);

                g.DrawLine(penLight, rect.X + 1, pageRect.Y + pageRect.Height, rect.X + 1, rect.Bottom - 2);
                g.DrawLine(penDark, rect.X, pageRect.Y + pageRect.Height, rect.X, rect.Bottom - 1);
            }
            else
            {
                g.DrawLine(penLight, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 2);
                g.DrawLine(penDark, rect.X, rect.Y + 1, rect.X, rect.Bottom - 1);
            }
        }
Exemplo n.º 14
0
        private void DrawPageTitleTopHorizontal(Graphics g, Pen penDark, StiTabulatorPage page, Rectangle rect)
        {
            #region Draw page header

            if (tabulator.SelectedTab == page)
            {
                g.DrawLine(penDark, new Point(rect.X, rect.Y), new Point(rect.X, rect.Bottom));
                g.DrawLine(penDark, new Point(rect.Right, rect.Y), new Point(rect.Right, rect.Bottom));

                using (var br = new SolidBrush(Color.FromArgb(43, 86, 154)))
                {
                    g.FillRectangle(br, rect.X, rect.Y, rect.Width + 1, 2);
                }
            }

            #endregion

            tabulator.Mode.DrawTitleText(g, rect, page);
            tabulator.Mode.DrawTitleImage(g, rect, page);
        }
Exemplo n.º 15
0
        private void DrawPageTopHorizontal(Graphics g, StiTabulatorPage page, Pen penLight, Pen penDark, Rectangle rect, Rectangle pageRect)
        {
            g.DrawLine(penDark, rect.X, rect.Y, rect.X, rect.Bottom);
            g.DrawLine(penDark, rect.X, rect.Bottom, rect.Right, rect.Bottom);
            g.DrawLine(penDark, rect.Right, rect.Y, rect.Right, rect.Bottom);

            if (((StiTabulator)page.Parent).ShowTitle)
            {
                g.DrawLine(penLight, rect.X + 1, rect.Y + 1, pageRect.X - 1, rect.Y + 1);
                g.DrawLine(penDark, rect.X + 1, rect.Y, pageRect.X, rect.Y);

                g.DrawLine(penLight, pageRect.X + pageRect.Width, rect.Y + 1, rect.Right - 2, rect.Y + 1);
                g.DrawLine(penDark, pageRect.X + pageRect.Width, rect.Y, rect.Right - 1, rect.Y);
            }
            else
            {
                g.DrawLine(penLight, rect.X + 1, rect.Y + 1, rect.Right - 2, rect.Y + 1);
                g.DrawLine(penDark, rect.X + 1, rect.Y, rect.Right - 1, rect.Y);
            }
        }
Exemplo n.º 16
0
        public override Rectangle GetTitlePageRectangle(StiTabulatorPage page)
        {
            int pageIndex = 0;

            foreach (StiTabulatorPage pg in tabulator.Controls)
            {
                if (pg.Invisible && (!tabulator.IsDesignMode))
                {
                    continue;
                }
                if (pg == page)
                {
                    break;
                }
                pageIndex++;
            }

            return(new Rectangle(tabulator.Width - tabulator.MaxTitleWidth,
                                 pageIndex * tabulator.MaxTitleHeight,
                                 tabulator.MaxTitleWidth - titleSpace, tabulator.MaxTitleHeight));
        }
Exemplo n.º 17
0
        public override Size MeasureTitle(Graphics g, StiTabulatorPage page)
        {
            Size titleSize = MeasureWrappedString(g, tabulator.Font, page.Text, 95);//Артем: статическая ширина заголовков

            titleSize.Width  += 6;
            titleSize.Height += 6;

            Rectangle imageRect = GetTitleImageRectangle(Rectangle.Empty, page);

            titleSize.Width   = Math.Max(titleSize.Width, imageRect.Width + 6);
            titleSize.Height += imageRect.Height + 6;

            if (tabulator.TitleWidth > 0)
            {
                titleSize.Width = tabulator.TitleWidth;
            }
            if (tabulator.TitleHeight > 0)
            {
                titleSize.Height = tabulator.TitleHeight;
            }

            return(titleSize);
        }
Exemplo n.º 18
0
        public virtual Size MeasureTitle(Graphics g, StiTabulatorPage page)
        {
            Size titleSize = g.MeasureString(page.Text, tabulator.Font).ToSize();

            titleSize.Width  += 6;
            titleSize.Height += 6;

            Rectangle imageRect = GetTitleImageRectangle(Rectangle.Empty, page);

            titleSize.Width += imageRect.Width + 6;
            titleSize.Height = Math.Max(titleSize.Height, imageRect.Height + 6);

            if (tabulator.TitleWidth > 0)
            {
                titleSize.Width = tabulator.TitleWidth;
            }
            if (tabulator.TitleHeight > 0)
            {
                titleSize.Height = tabulator.TitleHeight;
            }

            return(titleSize);
        }
Exemplo n.º 19
0
        private void DrawPageTitleRightHorizontal(Graphics g, StiTabulatorPage page, Rectangle rect, Rectangle contentRect)
        {
            if (page != tabulator.SelectedTab)
            {
                if (page.IsMouseOver)
                {
                    using (var br = new SolidBrush(StiColorUtils.Dark(StiColors.Content, 0)))
                    {
                        g.FillRectangle(br, contentRect);
                    }
                }
            }
            else
            {
                using (var br = new SolidBrush(StiColorUtils.Dark(StiColors.Content, 0)))
                {
                    g.FillRectangle(br, contentRect);
                }
            }

            tabulator.Mode.DrawTitleText(g, rect, page);
            tabulator.Mode.DrawTitleImage(g, rect, page);
        }
Exemplo n.º 20
0
        public virtual Rectangle GetTitleImageRectangle(Rectangle rect, StiTabulatorPage page)
        {
            SizeF imageSize = SizeF.Empty;

            if (tabulator.ImageList != null || page.Image != null)
            {
                if (tabulator.ImageList != null || page.Image != null)
                {
                    if (page.Image != null)
                    {
                        imageSize = page.Image.Size;
                    }
                    else
                    {
                        imageSize = tabulator.ImageList.ImageSize;
                    }

                    return(new Rectangle(rect.X + 4,
                                         (int)(rect.Y + (rect.Height - imageSize.Height) / 2),
                                         (int)imageSize.Width, (int)imageSize.Height));
                }
            }
            return(Rectangle.Empty);
        }
Exemplo n.º 21
0
        protected override bool GetHitTest(Point point)
        {
            StiTabulatorPage page = tabControl.GetTabPageAtPoint(tabControl.PointToClient(point));

            return(page != null);
        }
 internal Rectangle GetTitlePageRectangle(Graphics g, StiTabulatorPage page)
 {
     return(Mode.GetTitlePageRectangle(page));
 }
Exemplo n.º 23
0
        public virtual void DrawTitleText(Graphics g, Rectangle rect, StiTabulatorPage page)
        {
            Rectangle textRect = GetTitleTextRectangle(rect, page);

            g.DrawString(page.Text, tabulator.Font, SystemBrushes.ControlText, textRect, tabulator.sfTabs);
        }
        private void DrawPageTitleTopHorizontal(Graphics g, Pen penLight, Pen penDark, StiTabulatorPage page,
                                                Rectangle rect, Rectangle contentRect)
        {
            Point [] pts = new Point[] {
                new Point(rect.X, rect.Y),
                new Point(rect.X, rect.Bottom),
                new Point(rect.Right + 5, rect.Bottom + 1),
                new Point(rect.Right - 5, rect.Y)
            };

            using (var path = new GraphicsPath(FillMode.Alternate))
            {
                path.AddPolygon(pts);

                #region Draw page header
                if (tabulator.SelectedTab == page)
                {
                    using (var br = new SolidBrush(tabulator.BackColor))
                    {
                        g.FillPath(br, path);
                    }
                }
                else
                {
                    if (page.IsMouseOver)
                    {
                        using (var br = new SolidBrush(StiColorUtils.Dark(StiColors.Content, 0)))
                        {
                            g.FillPath(br, path);
                        }
                    }
                    else
                    {
                        using (var br = new SolidBrush(StiColorUtils.Dark(StiColors.Content, 10)))
                        {
                            g.FillPath(br, path);
                        }
                    }
                }
                #endregion

                #region Draw header lines
                if (tabulator.SelectedTab == page)
                {
                    g.DrawLine(penDark, pts[0], pts[1]);
                    g.DrawLine(penLight, pts[0].X + 1, pts[0].Y + 1, pts[1].X + 1, pts[1].Y + 1);

                    g.DrawLine(penDark, pts[2], pts[3]);

                    g.DrawLine(penDark, pts[0], pts[3]);
                    g.DrawLine(penLight, pts[0].X + 1, pts[0].Y + 1, pts[3].X - 1, pts[3].Y + 1);
                }
                else
                {
                    g.DrawLine(penDark, pts[0], pts[1]);
                    g.DrawLine(penDark, pts[0], pts[3]);
                    g.DrawLine(penDark, pts[2], pts[3]);
                }
                #endregion
            }
            tabulator.Mode.DrawTitleText(g, rect, page);
            tabulator.Mode.DrawTitleImage(g, rect, page);
        }
        private void DrawPageTitleLeftHorizontal(Graphics g, Pen penLight, Pen penDark, StiTabulatorPage page,
                                                 Rectangle rect, Rectangle contentRect)
        {
            if (page != tabulator.SelectedTab)
            {
                int size = 4;
                rect.X            += size;
                rect.Width        -= size;
                contentRect.X     += size;
                contentRect.Width -= size;
            }

            g.DrawLine(penDark, rect.X + 1, rect.Y, rect.Right, rect.Y);
            g.DrawLine(penDark, rect.X, rect.Y + 1, rect.X, rect.Bottom - 1);
            g.DrawLine(penDark, rect.X + 1, rect.Bottom, rect.Right, rect.Bottom);

            if (page != tabulator.SelectedTab)
            {
                if (page.IsMouseOver)
                {
                    using (var br = new SolidBrush(StiColorUtils.Dark(StiColors.Content, 0)))
                    {
                        g.FillRectangle(br, contentRect);
                    }
                }
                else
                {
                    using (var br = new SolidBrush(StiColorUtils.Dark(StiColors.Content, 10)))
                    {
                        g.FillRectangle(br, contentRect);
                    }
                }
            }
            else
            {
                using (var br = new SolidBrush(tabulator.BackColor))
                {
                    g.FillRectangle(br, contentRect);
                }

                g.DrawLine(penLight, rect.X + 2, rect.Y + 1, rect.Right, rect.Y + 1);
                g.DrawLine(penLight, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 1);
            }

            tabulator.Mode.DrawTitleText(g, rect, page);
            tabulator.Mode.DrawTitleImage(g, rect, page);
        }
Exemplo n.º 26
0
 public abstract Rectangle GetTitlePageRectangle(StiTabulatorPage page);
Exemplo n.º 27
0
 public void DrawPageTitle(Graphics g, StiTabulatorPage page)
 {
     tabulator.Style.DrawPageTitle(g, TabTitlePosition, page);
 }
        private void DrawPageTitleRightHorizontal(Graphics g, Pen penLight, Pen penDark, StiTabulatorPage page,
                                                  Rectangle rect, Rectangle contentRect)
        {
            if (page != tabulator.SelectedTab)
            {
                if (page.IsMouseOver)
                {
                    using (var br = new SolidBrush(StiStyleOffice2013Blue.ColorButtonButtonMouseOver))
                    {
                        g.FillRectangle(br, contentRect);
                    }
                }
                else
                {
                    using (var br = new SolidBrush(Color.White))
                    {
                        g.FillRectangle(br, contentRect);
                    }
                }
            }
            else
            {
                using (var br = new SolidBrush(StiStyleOffice2013Blue.ColorButtonChecked))
                {
                    g.FillRectangle(br, contentRect);
                }
            }

            tabulator.Mode.DrawTitleText(g, rect, page);
            tabulator.Mode.DrawTitleImage(g, rect, page);
        }