示例#1
0
 protected void OnTabPaint(TabPaintEventArgs e)
 {
     if (TabPaint != null)
     {
         TabPaint(this, e);
     }
 }
示例#2
0
        protected void PaintTab(BpTabPage page, Graphics g)
        {
            Rectangle          bounds  = GetTabRect(page);
            VisualStyleElement element = GetElement(page);

            if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(element))
            {
                VisualStyleRenderer renderer = new VisualStyleRenderer(element);
                renderer.DrawBackground(g, bounds);
                bounds = renderer.GetBackgroundContentRectangle(g, bounds);
            }
            else
            {
                ControlPaint.DrawBorder3D(g, bounds, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Middle);
            }

            if (IncludesCloseButton(page))
            {
                Rectangle closerect = GetTabCloseRect(page, bounds);
                element = VisualStyleElement.ToolTip.Close.Normal;
                Border3DStyle borderstyle = Border3DStyle.Flat;
                if (hoverClose)
                {
                    if (clickClose == page)
                    {
                        element     = VisualStyleElement.ToolTip.Close.Pressed;
                        borderstyle = Border3DStyle.Sunken;
                    }
                    else if (clickClose == null)
                    {
                        element     = VisualStyleElement.ToolTip.Close.Hot;
                        borderstyle = Border3DStyle.Raised;
                    }
                }
                if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(element))
                {
                    VisualStyleRenderer renderer = new VisualStyleRenderer(element);
                    renderer.DrawBackground(g, closerect);
                }
                else
                {
                    if (borderstyle != Border3DStyle.Flat)
                    {
                        ControlPaint.DrawBorder3D(g, closerect, borderstyle);
                    }
                    Font  closefont = new Font("Marlett", SystemFonts.MenuFont.Size);
                    Point pos       = closerect.Location;
                    pos.X += SystemInformation.Border3DSize.Width;
                    pos.Y += SystemInformation.Border3DSize.Height;
                    TextRenderer.DrawText(g, "r", closefont, pos, Color.Black);
                }
            }

            bounds = GetTabContentRect(page, bounds);
            TabPaintEventArgs ea = new TabPaintEventArgs(g, bounds, page);

            OnTabPaint(ea);
            page.CallTabPaint(ea);
        }
示例#3
0
        protected virtual void OnTabPaint(TabPaintEventArgs e)
        {
            BpTabControl tabs   = (BpTabControl)Parent;
            Rectangle    bounds = e.ClipRectangle;

            if ((imgIndex >= 0) && (imgIndex < tabs.ImageList.Images.Count))
            {
                int y = bounds.Y;
                y += (bounds.Height - tabs.ImageList.ImageSize.Height) / 2;
                tabs.ImageList.Draw(e.Graphics, bounds.X, y, imgIndex);
                bounds = new Rectangle(bounds.X + tabs.ImageList.ImageSize.Width + padding, bounds.Y, bounds.Width - tabs.ImageList.ImageSize.Width - padding, bounds.Height);
            }
            DrawTabText(e.Graphics, bounds, Text,
                        TextFormatFlags.EndEllipsis | TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
            if (TabPaint != null)
            {
                TabPaint(this, e);
            }
        }
示例#4
0
 internal void CallTabPaint(TabPaintEventArgs e)
 {
     OnTabPaint(e);
 }